Possible Duplicate:
Fetching datetime from float and vice versa in python
Like many people I switched from Matlab
to Python
. Matlab
represents each date as a number. (Integers
being days since 00-00-0000
, and fractions being time in the day). I believe that python
does the same except off a different start date 0-0-0001
I have been playing around with datetime
, but cant seem to get away from datetime
objects and timedeltas
. I am sure this is dead simple, but how do I work with plain old numbers (floats)?
perhaps as a bit of context:
i bring in a date and time stamp and concatenate them to make one time value:
from datetime import datetime
date_object1 = datetime.strptime(date[1][0] + ' ' + date[1][1], '%Y-%m-%d %H:%M:%S')
date_object2 = datetime.strptime(date[2][0] + ' ' + date[2][1], '%Y-%m-%d %H:%M:%S')