当前位置: 首页 > news >正文

深圳企业公司网站设计搜索引擎优化举例说明

深圳企业公司网站设计,搜索引擎优化举例说明,网站建设上线流程,百度搜索推广方法效果 最近7天:2024年6月21日-2024年6月27日过去一周、最近一周:2024年6月16日-2024年6月22日过去三个月:2024年3月-2024年6月近半年、过去半年:2023年12月-2024年6月去年:2023年1月-2023年12月过去3年:202…

效果

  1. 最近7天:2024年6月21日-2024年6月27日
  2. 过去一周、最近一周:2024年6月16日-2024年6月22日
  3. 过去三个月:2024年3月-2024年6月
  4. 近半年、过去半年:2023年12月-2024年6月
  5. 去年:2023年1月-2023年12月
  6. 过去3年:2021年1月-2024年12月
  7. 累计:2020年1月1日-2024年6月27日

代码

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.WeekFields;
import java.util.Locale;public class DataFormatUtil {public static String getDates(String timeType) {LocalDate now = LocalDate.now();if ("日".equals(timeType)) {// 格式化为 YYYY-MM-DDreturn now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));}if ("周".equals(timeType)) {// 格式化为 YYYY-WX// 周数(W)是按照ISO 8601标准,每周从周一开始,每年的第一周至少包含4天return now.format(DateTimeFormatter.ofPattern("yyyy-'W'ww"));}if ("月".equals(timeType)) {// 格式化为 YYYY-MMreturn now.format(DateTimeFormatter.ofPattern("yyyy-MM"));}if ("季".equals(timeType)) {// 格式化为 YYYY-QX// 季度(Q)是按照每个季度三个月计算,1-3月为第一季度,4-6月为第二季度,依此类推String quarter = String.valueOf((now.getMonthValue() - 1) / 3 + 1);return now.format(DateTimeFormatter.ofPattern("yyyy")) + "-Q" + quarter;}if ("年".equals(timeType)) {// 格式化为 YYYYreturn now.format(DateTimeFormatter.ofPattern("yyyy"));}return "未知时间颗粒度";}/*** 处理特殊时间** @return 结果*/public static String getAllTimeRanges() {// 获取当前时间并格式化为字符串LocalDate now = LocalDate.now();DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");String currentDateString = now.format(formatter);LocalDate currentDate = LocalDate.parse(currentDateString, DateTimeFormatter.BASIC_ISO_DATE);LocalDate startDate;String[] timeRanges = new String[8];// 最近7天startDate = currentDate.minusDays(6);timeRanges[0] = String.format("最近7天:%d年%d月%d日-%d年%d月%d日",startDate.getYear(), startDate.getMonthValue(), startDate.getDayOfMonth(),currentDate.getYear(), currentDate.getMonthValue(), currentDate.getDayOfMonth());// 过去一周、最近一周startDate = currentDate.with(WeekFields.of(Locale.getDefault()).dayOfWeek(), 1).minusWeeks(1);LocalDate endDate = startDate.plusDays(6);timeRanges[1] = String.format("过去一周、最近一周:%d年%d月%d日-%d年%d月%d日",startDate.getYear(), startDate.getMonthValue(), startDate.getDayOfMonth(),endDate.getYear(), endDate.getMonthValue(), endDate.getDayOfMonth());// 过去三个月startDate = currentDate.minusMonths(3);timeRanges[2] = String.format("过去三个月:%d年%d月-%d年%d月",startDate.getYear(), startDate.getMonthValue(),currentDate.getYear(), currentDate.getMonthValue());// 近半年、过去半年startDate = currentDate.minusMonths(6);timeRanges[3] = String.format("近半年、过去半年:%d年%d月-%d年%d月",startDate.getYear(), startDate.getMonthValue(),currentDate.getYear(), currentDate.getMonthValue());// 去年startDate = currentDate.minusYears(1).withMonth(1).withDayOfMonth(1);endDate = startDate.plusYears(1).minusDays(1);timeRanges[4] = String.format("去年:%d年1月-%d年12月",startDate.getYear(), startDate.getYear());// 过去3年startDate = currentDate.minusYears(3);timeRanges[5] = String.format("过去3年:%d年1月-%d年12月",startDate.getYear(), currentDate.getYear());// 累计,这里假设项目开始日期为2020年1月1日startDate = LocalDate.of(2020, 1, 1);timeRanges[6] = String.format("累计:%d年1月1日-%d年%d月%d日",startDate.getYear(), currentDate.getYear(), currentDate.getMonthValue(), currentDate.getDayOfMonth());// 为了简化,这里我们忽略"近XX月"、"近XX年"的情况,因为它们与"过去XX月"、"过去XX年"的处理相同StringBuilder result = new StringBuilder();for (int i = 0; i < timeRanges.length - 1; i++) {result.append(i + 1).append(". ").append(timeRanges[i]).append("\n");}return result.toString();}
}
http://www.hkea.cn/news/976798/

相关文章:

  • 南充营销型网站建设高端品牌网站建设
  • 制作小程序和网站的公司搜狗收录提交入口网址
  • 手机站电影基础建站如何提升和优化
  • 江苏 网站备案百度贴吧官网app下载
  • 网站制作三站湖南网站seo公司
  • 简单做任务赚钱网站企业管理培训课程报名
  • 零点研究咨询集团官方网站建设相似图片在线查找
  • 网站开发需要什么软件关键词app
  • 360全景网站建设做了5天游戏推广被抓了
  • 政府网站建设经验典型材料河源今日头条新闻最新
  • 为什么要进行网站备案佛山市人民政府门户网站
  • 摄影网站开发背景百度app交易平台
  • 吉林网站建设石家庄百度快照优化排名
  • 大学生网站开发总结报告app推广接单发布平台
  • 自己做的网站怎么推广seo顾问培训
  • 怎么做业务网站百度搜索提交入口
  • 网页设计网站图片西安百度推广运营公司
  • 济南网站开发推广网络服务包括
  • 五星级酒店网站建设关键词歌词表达的意思
  • 浙江高端建设网站网站关键词如何优化
  • 2017网站开发工程师五合一网站建设
  • 学编程的孩子有什么好处seo网站诊断文档案例
  • 广州中新知识城开发建设网站无锡百姓网推广
  • 宝鸡做网站费用关键词你们懂的
  • wordpress 仿站 教程百度竞价点击一次多少钱
  • 做h的游戏 迅雷下载网站百度推广管家
  • 营销型网站建设的目的外贸网站平台都有哪些 免费的
  • 广东做网站公司广州从化发布
  • 能发外链的网站国际新闻今天最新消息
  • 做软件的网站关键词优化快速排名