Parcourir la source

调整日志时区

zhangqian il y a 1 an
Parent
commit
03e7b9a041

+ 2 - 1
src/main/java/com/greentech/gateservice/task/GateLogService.java

@@ -21,6 +21,7 @@ import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 
 @RequestMapping("crud")
 @Data
@@ -38,7 +39,7 @@ public class GateLogService {
     public void syncLog() {
         System.out.println("--开始执行日志查询同步任务--");
         String format = "yyyy-MM-dd HH:mm:ss";
-        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
         //获取前一小时
         LocalDateTime now = LocalDateTime.now();
         LocalDateTime startTime = now.minusHours(1);