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.
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.
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>)
>>>
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