My code:
import datetime as dt
import scikits.timeseries as ts
ts_start_datetime= ts.Date(freq='T',year=2011,month=1,day=1,hour= 0,minute=0)
ts_end_datetime = ts.Date(freq='T',year=2011,month=12,day=31,hour=23,minute=45)
start_val = ts_start_datetime.value
# 21564001
end_val = ts_end_datetime.value
# 22089586
How do I convert start_val and end_val to datetime objects?
Use
datetime.fromtimestamp(), since your values appear to be minutes rather than seconds, first multiply them by 60:If you want a UTC time instead of a local time, use
datetime.utcfromtimestamp():I’m not exactly sure why each of these are one minute after what you started with, you can always subtract 60 before the call or subtract
dt.timedelta(minutes=1)from the end result.