user2639990
user2639990

Reputation:

converting JSON python time to regular time

I have the following python time value in JSON format...any inputs on how to convert it to to regular time format

u'lastUpdated': 1358294533

Upvotes: 0

Views: 70

Answers (1)

Eugen Constantin Dinca
Eugen Constantin Dinca

Reputation: 9150

datetime.fromtimestamp from the datetime module should do it.

For example:

>>> from datetime import datetime
>>> d = datetime.fromtimestamp(1358294533)
>>> d.isoformat()
'2013-01-15T19:02:13'

For getting a more controlled string representation of the datetime use the datetime.strftime function.

Upvotes: 2

Related Questions