@@ -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