Commit c42a5e27 authored by 张永's avatar 张永

Update DateUtil.java

parent 6cb16bb0
...@@ -427,6 +427,27 @@ public class DateUtil { ...@@ -427,6 +427,27 @@ public class DateUtil {
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