java的起始时间_java获取当天起始与结束时间 .

  • Post author:
  • Post category:java


01.private Long getStartTime(){

02. Calendar todayStart = Calendar.getInstance();

03. todayStart.set(Calendar.HOUR, 0);

04. todayStart.set(Calendar.MINUTE, 0);

05. todayStart.set(Calendar.SECOND, 0);

06. todayStart.set(Calendar.MILLISECOND, 0);

07. return todayStart.getTime().getTime();

08. }

09.

10. private Long getEndTime(){

11. Calendar todayEnd = Calendar.getInstance();

12. todayEnd.set(Calendar.HOUR, 23);

13. todayEnd.set(Calendar.MINUTE, 59);

14. todayEnd.set(Calendar.SECOND, 59);

15. todayEnd.set(Calendar.MILLISECOND, 999);

16. return todayEnd.getTime().getTime();

17. }

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2013-05-22 10:59

浏览 3240

评论



版权声明:本文为weixin_35418139原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。