Django, so to speak, does not do Python. I seem to be wrong here, as the answer on uptimebox shows.
Suppose you parse this line: "Wed Apr 21 19:29:07 +0000 2010" (this is from the Twitter JSON API)
You have analyzed it as a datetime object as follows:
import datetime JSON_time = 'Wed Apr 21 19:29:07 +0000 2010' my_time = datetime.datetime.strptime(JSON_time, '%a %b %d %H:%M:%S +0000 %Y') print type(my_time)
You will get this by confirming that it is a datetime object:
<type 'datetime.datetime'>
More information on strptime() can be found here .
Zack
source share