Browse Source

修改时间格式

develop
王兴琳 4 months ago
parent
commit
13f4357a78
  1. 4
      zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java

4
zc-business/src/main/java/com/zc/business/controller/DcTrafficFlowWarning.java

@ -35,7 +35,7 @@ public class DcTrafficFlowWarning {
@Autowired @Autowired
private IDcTollStationStatisticsDataService iDcTollStationStatisticsDataService; private IDcTollStationStatisticsDataService iDcTollStationStatisticsDataService;
// @Scheduled(cron = "0/10 * * * * ?") //@Scheduled(cron = "0/2 * * * * ?")
@Scheduled(cron = "0 0 9 * * ?") @Scheduled(cron = "0 0 9 * * ?")
public void DcTrafficFlow() throws ParseException { public void DcTrafficFlow() throws ParseException {
// 获取当前日期 // 获取当前日期
@ -49,7 +49,7 @@ public class DcTrafficFlowWarning {
// 计算当前日期加上七天的日期 // 计算当前日期加上七天的日期
LocalDate dateAfterSevenDays = currentDate.plusDays(UniversalEnum.SEVEN.getNumber()); LocalDate dateAfterSevenDays = currentDate.plusDays(UniversalEnum.SEVEN.getNumber());
// 格式化日期输出(可选) // 格式化日期输出(可选)
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_ALL.getValue()); DateTimeFormatter formatter = DateTimeFormatter.ofPattern(UniversalEnum.TIME_FORMAT_YEARS_MONTH_DAY.getValue());
DateTimeFormatter formatterStr = DateTimeFormatter.ofPattern(UniversalEnum.PURE_CHINESE_CHARACTER_TIME_FORMATS_YEARS_MONTH_DAY.getValue()); DateTimeFormatter formatterStr = DateTimeFormatter.ofPattern(UniversalEnum.PURE_CHINESE_CHARACTER_TIME_FORMATS_YEARS_MONTH_DAY.getValue());
String formattedDate = dateAfterSevenDays.format(formatter); String formattedDate = dateAfterSevenDays.format(formatter);
String formattedDateStr = dateAfterSevenDays.format(formatterStr); String formattedDateStr = dateAfterSevenDays.format(formatterStr);

Loading…
Cancel
Save