my-csc-config-file.git 3 jaren geleden
bovenliggende
commit
300655227c
2 gewijzigde bestanden met toevoegingen van 29 en 0 verwijderingen
  1. 2 0
      src/main/java/com/unissoft/MyConstant.java
  2. 27 0
      src/main/java/com/unissoft/utils/DateUtil.java

+ 2 - 0
src/main/java/com/unissoft/MyConstant.java

@@ -24,6 +24,7 @@ public class MyConstant {
24 24
     //是否
25 25
     public static final int ZERO = 0;
26 26
     public static final int ONE = 1;
27
+    public static final int ONE_HUNDRED = 100;
27 28
     public static final int NEGATIVE_ONE = -1;
28 29
     public static final int TWO = 2;
29 30
     public static final int THREE = 3;
@@ -37,6 +38,7 @@ public class MyConstant {
37 38
     public static final String FORTY = "40";
38 39
     public static final String STR_TIME = " 00:00:00";
39 40
     public static final String STR_END = " 23:59:59";
41
+    public static final String BURDEN_ZERO = "-00";
40 42
 
41 43
     public static final String LOGIN_USER = "loginUser";
42 44
     //请求认证头

+ 27 - 0
src/main/java/com/unissoft/utils/DateUtil.java

@@ -480,4 +480,31 @@ public class DateUtil {
480 480
         return calendar.get(Calendar.WEEK_OF_YEAR);
481 481
     }
482 482
 
483
+    /**
484
+     * 获取当前时间
485
+     * @return
486
+     * @throws ParseException
487
+     */
488
+    public static Date getTime()throws ParseException{
489
+        Date time = Calendar.getInstance().getTime();
490
+        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd HH:mm");
491
+        String format = dateFormat.format(time);
492
+        Date date = dateFormat.parse(format);
493
+       return date;
494
+    }
495
+
496
+    /**
497
+     * 获取上一个月的日期
498
+     * @return
499
+     * @throws ParseException
500
+     */
501
+    public static String getLastMonth(){
502
+        Calendar c = Calendar.getInstance();
503
+        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd");
504
+        c.setTime(new Date());
505
+        c.add(Calendar.MONTH, -1);
506
+        Date m = c.getTime();
507
+        String mon = dateFormat.format(m);
508
+       return mon;
509
+    }
483 510
 }