Commit e4ad01d0 authored by yanzg's avatar yanzg

修改日志打印功能,打印更加详细的日志

parent a4537ca6
...@@ -276,7 +276,7 @@ public class DateHelper { ...@@ -276,7 +276,7 @@ public class DateHelper {
public static int getMonth(Date date) { public static int getMonth(Date date) {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.setTime(date); c.setTime(date);
return c.get(Calendar.MONTH); return c.get(Calendar.MONTH) + 1;
} }
/** /**
......
...@@ -72,4 +72,13 @@ public class TestDateHelper { ...@@ -72,4 +72,13 @@ public class TestDateHelper {
System.out.println(json); System.out.println(json);
Assert.assertEquals("[{\"from\":\"2023-07-01 10:00:00\",\"to\":\"2023-07-01 19:00:00\"}]", json); Assert.assertEquals("[{\"from\":\"2023-07-01 10:00:00\",\"to\":\"2023-07-01 19:00:00\"}]", json);
} }
@Test
public void testDayMonth() {
Date dt = DateHelper.getDateTime("2023-12-12 15:59:59");
Assert.assertEquals(2023,DateHelper.getYear(dt));
Assert.assertEquals(12,DateHelper.getMonth(dt));
Assert.assertEquals(12,DateHelper.getDay(dt));
Assert.assertEquals(15,DateHelper.getHour(dt));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment