How to get today's Date?

后端 未结 8 2026
予麋鹿
予麋鹿 2021-01-31 14:28

In other words, I want functionality that provides Joda-Time:

today = today.withTime(0, 0, 0, 0);

but without Joda-Time, only with java.util.Da

8条回答
  •  萌比男神i
    2021-01-31 15:06

    Date today = DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH);
    

    DateUtils from Apache Commons-Lang. Watch out for time zone!

提交回复
热议问题