java . 时间

1:DateTime
 
 
Date startDate1 = new DateTime().millisOfDay().withMinimumValue().toDate();//今天的 00:00:00
System.out.println("今天的开始"+startDate1);

Date startDate2 = new DateTime().millisOfDay().withMaximumValue().toDate();//今天的23:59:59
System.out.println("今天的最后"+startDate2);

Date startDate = new DateTime().minusDays(1).millisOfDay().withMinimumValue().toDate();//前一天的 00:00:00
Date endDate = new DateTime().minusDays(1).millisOfDay().withMaximumValue().toDate(); //前一天的 23:59:59
2:Date
 Date startDate = new Date(new Date().getTime() - 300000);//5分钟前

 
 


猜你喜欢

转载自blog.csdn.net/u013694478/article/details/80815690