Задать вопрос

Тел: +7 965 3737 888

462

Просмотров

1

Ответов

JSON decode datetime

<p>If you have JSON objects with datetime attributes that you want to decode to python <a href="http://docs.python.org/library/datetime.html#datetime.datetime">datetime</a> objects, you can use decode_datetime as a <a href="http://simplejson.googlecode.com/svn/tags/simplejson-2.0.9/docs/index.html">simplejson</a> object hook. simplejson.loads(s, object_hook=decode_datetime).</p>

Вопрос полезен? Да0/Нет0
file_2369.py(178.0б)
None

Ответы (1):

Ответschinckel:05.08.2010
Ответ полезен? Да0/Нет0

If you have datetime objects as "%Y-%m-%d %H:%M:%S", then you don't need to convert them. Django will allow for using these in queries, and saving to the database.

Same with date ("%Y-%m-%d") and time ("%H:%M:%S") objects.