Commit 28cf2dc7 authored by Quxl's avatar Quxl
parents b76aaa3b c42a5e27
...@@ -31,6 +31,8 @@ public class DateUtil { ...@@ -31,6 +31,8 @@ public class DateUtil {
public static final String FMT_YYYYMMddHHMMSS = "yyyyMMddHHmmss"; public static final String FMT_YYYYMMddHHMMSS = "yyyyMMddHHmmss";
public static final String FMT_UTC_ALIYUN="yyyy-MM-dd'T'HH:mm:ss'Z'"; public static final String FMT_UTC_ALIYUN="yyyy-MM-dd'T'HH:mm:ss'Z'";
public static final String FMT_YYYY_MM = "yyyy/MM";
public static final Long SECOND = 1000L; public static final Long SECOND = 1000L;
public static final Long MINUTE = 1000L*60; public static final Long MINUTE = 1000L*60;
public static final Long HALF_HOUR = MINUTE*30; public static final Long HALF_HOUR = MINUTE*30;
...@@ -424,6 +426,27 @@ public class DateUtil { ...@@ -424,6 +426,27 @@ public class DateUtil {
c.add(Calendar.MONTH, 0); c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
return c.getTime(); return c.getTime();
}
/**
 * 获取指定日期下个月的第一天 的日期
* @param dateStr
* @param format
* @return
*/
public static String getFirstDayOfNextMonth(String dateStr,String format){
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
Date date = sdf.parse(dateStr);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_MONTH,1);
calendar.add(Calendar.MONTH, 1);
return sdf.format(calendar.getTime());
} catch (ParseException e) {
e.printStackTrace();
}
return null;
} }
public static String getTimeStamp() { public static String getTimeStamp() {
return String.valueOf(System.currentTimeMillis() / 1000); return String.valueOf(System.currentTimeMillis() / 1000);
......
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