[Python-Dev] datetime module enhancements
BJörn Lindqvist
bjourne at gmail.com
Fri Mar 9 18:24:34 CET 2007
On 3/9/07, Guido van Rossum <guido at python.org> wrote:
> On 3/9/07, skip at pobox.com <skip at pobox.com> wrote:
> > The range of datetime objects far exceeds that of the current Unix
> > timestamp. Given that the range of current (32-bit) Unix timestamps is
> > approximately 1970 to 2038, What would the output of this be?
> >
> > dt = datetime.datetime(3000, 1, 1, 0, 0, 0)
> > print dt.totimestamp()
> > dt = datetime.datetime(1900, 1, 1, 0, 0, 0)
> > print dt.totimestamp()
>
> If you extend the range to 64 bits there's no problem: the first
> should print 32503680000, the second -2208988800.
I think it should be a ValueError, given that the programmer is very
likely to further use the returned timestamp to for example insert
stuff in a database. Unix timestamps are not unambiguously defined for
any years other than 1970 to 2038 imho.
--
mvh Björn
More information about the Python-Dev
mailing list