Reputation: 3015
What time format is this 2014-06-14T16:46:01.000Z
?
How can I strftime
that into human readable form? I don't recognized what the T
and Z
mean.
Upvotes: 0
Views: 679
Reputation: 28563
To convert this don't use strftime
use date.util
import dateutil.parser
nowdate = dateutil.parser.parse(datestring)
you can also use https://bitbucket.org/micktwomey/pyiso8601
>>> import iso8601
>>> iso8601.parse_date("2007-01-25T12:00:00Z")
datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.Utc>)
>>>
Upvotes: 3
Reputation: 6729
You can't run an strftime
as it can be applied only on date objects. But you can convert this string to a dateobject using strftime
from datetime import datetime
date = datetime.strptime("2014-06-14T16:46:01.000Z", "%Y-%m-%dT%H:%M:%S.%fZ")
print date
output
2014-06-14 16:46:01
T and Z are designatiors for time and zone
Upvotes: 2
Reputation: 43495
It is a combined date and time representation according to ISO 8601.
Upvotes: 2