from datetime import datetime
roughtime = datetime(2018,1,1,5,2,1)
I want to floor roughtime
as datetime.datetime(2018, 1, 1, 0, 0, 0)
and also ceil roughtime
as datetime.datetime(2018, 1, 2, 0, 0, 0)
.
Is there any convenient way to realize this? I know I can convert roughtime
using matplotlib.dates.date2num. But I wonder if there are other ingenious ideas