time as float since Jan 1, 0001?

2013-02-23 Thread Roy Smith
I'm working with matplotlib.plot_date(), which represents time as floats starting at January 1st, year 0001. Is there any straight-forward way to get that out of a datetime? datetime.toordinal() gives me the number of days since that epoch, but as an integer. I figured it wouldn't be too

Re: time as float since Jan 1, 0001?

2013-02-23 Thread Mark Lawrence
On 23/02/2013 13:29, Roy Smith wrote: I'm working with matplotlib.plot_date(), which represents time as floats starting at January 1st, year 0001. Is there any straight-forward way to get that out of a datetime? datetime.toordinal() gives me the number of days since that epoch, but as an

Re: time as float since Jan 1, 0001?

2013-02-23 Thread Chris Angelico
On Sun, Feb 24, 2013 at 12:29 AM, Roy Smith r...@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

Re: time as float since Jan 1, 0001?

2013-02-23 Thread Roy Smith
In article mailman.2342.1361626870.2939.python-l...@python.org, Mark Lawrence breamore...@yahoo.co.uk wrote: On 23/02/2013 13:29, Roy Smith wrote: I'm working with matplotlib.plot_date(), which represents time as floats starting at January 1st, year 0001. Is there any straight-forward