time as float since Jan 1, 0001?

Chris Angelico rosuav at gmail.com
Sat Feb 23 14:45:05 CET 2013


On Sun, Feb 24, 2013 at 12:29 AM, Roy Smith <roy at panix.com> wrote:
> datetime.toordinal() gives me the number of days since that epoch, but
> as an integer.  I figured it wouldn't be too hard to just do:
>
> t.toordinal() + t.time().total_seconds()

What about t.timestamp()? That's since 1970, but you could add (if my
calculations are correct) 62135683200.0 to it.

ChrisA



More information about the Python-list mailing list