How do I create a new Joda DateTime truncated to the last hour? [duplicate]

此生再无相见时 提交于 2019-12-09 05:00:44

问题


I am pulling timestamps from a file that I want to create a new DateTime for, but I want to create the DateTime at the floor of the hour (or any Joda Period will do).
How Can I do this?


回答1:


Wohoo, found it. Simple like everything in Joda once I traced down the calls.

DateTime dt = new DateTime().hourOfDay().roundFloorCopy();


来源:https://stackoverflow.com/questions/1207957/how-do-i-create-a-new-joda-datetime-truncated-to-the-last-hour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!