public class Test1 { public static void main(String[]args){ System.out.println("时间为:\n"+getDate1()+"\n"+getDate2()+"\n"+getDate3()+"\n"+getDate4()+"\n"+getDate5()); } /* Calendar.HOUR_OF_DAY 24小时制 Calendar…
一.获取传入日期所在月的第一天 public static Date getFirstDayDateOfMonth(final Date date) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, last); return ca…
1.推荐使用java8 localdate等 线程安全 支持较好 地址 2.joda 一.简述 查看SampleDateFormat源码,叙述有: * Date formats are not synchronized. * It is recommended to create separate format instances for each thread. * If multiple threads access a format concurrently, it must be syn…