Browse Source

补充提交

wangb@gyee-china.com 1 year ago
parent
commit
a8fa97de33
1 changed files with 12 additions and 0 deletions
  1. 12 0
      common/src/main/java/com/gyee/common/util/DateUtils.java

+ 12 - 0
common/src/main/java/com/gyee/common/util/DateUtils.java

@@ -963,6 +963,18 @@ public class DateUtils  {
     }
 
     /**
+     * 用于从日期对象中获取月份的字符串形式
+     * @param date
+     * @return
+     */
+    // 定义一个方法,用于从日期对象中获取月份的字符串形式
+    public static Integer getMonthFromDate(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int month = calendar.get(Calendar.MONTH) + 1;
+        return (month);
+    }
+    /**
      * 获得指定时间的年数
      *
      * @param date