How can I convert a python timestamp into day of year:
You might want to take a look at the function
datetime.timetuple() which returns a
time.struct_time object with your desired attribute. It has a named tuple interface, so you can access the values by index or attribute name.
import datetime date = datetime.datetime.strptime("2015-06-01 00:00:00", "%Y-%m-%d %H:%M:%S") print date.timetuple().tm_yday #=> 152