Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize datetime 0000-00-00 00:00:00 in Python?

I've been trying to use the datetime library in python to create a datetime object with this value: '0000-00-00 00:00:00'. However, I keep getting an error that the year is out of range. How can I properly initialize this?

like image 327
user3802348 Avatar asked Mar 07 '16 18:03

user3802348


1 Answers

There is no year 0, because people couldn't figure out how to count properly back then.

The closest you can get:

>>> from datetime import datetime
>>> datetime.min
datetime.datetime(1, 1, 1, 0, 0)
like image 195
wim Avatar answered Nov 01 '22 19:11

wim