47
Try this:
>>> import datetime
>>> datetime.datetime.max
datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
You can get min
/max
for datetime
, date
, and time
.
29
There isn’t; the best you have is the datetime.datetime.min
and datetime.datetime.max
values.
These are guaranteed to be the smallest and largest datetime
values, but datetime.datetime.min == datetime.datetime.min
is still True
; everything else is larger. The inverse is true for the datatime.datetime.max
value.
There are also min
and max
values for datetime.date
and datetime.time
.
- [Django]-Visual Studio Code: Intellisense not working
- [Django]-How to change the name of a Django app?
- [Django]-Factory-boy create a list of SubFactory for a Factory
3
In case someone is using dates in Pandas dataframe:
>>> import pandas as pd
>>> pd.Timestamp.min
Timestamp('1677-09-21 00:12:43.145225')
>>> pd.Timestamp.max
Timestamp('2262-04-11 23:47:16.854775807')
- [Django]-How to get the username of the logged-in user in Django?
- [Django]-Django setting environment variables in unittest tests
- [Django]-Django: Multiple forms possible when using FormView?
Source:stackexchange.com