rfc3339

What exactly does the T and Z mean in timestamp?

What exactly does the T and Z mean in timestamp? Question: I have this timestamp value being return by a web service “2014-09-12T19:34:29Z” I know that it means timezone, but what exactly does it mean? And I am trying to mock this web service, so is there a way to generate this timestamp using strftime …

Total answers: 1

How to convert Python's .isoformat() string back into datetime object

How to convert Python's .isoformat() string back into datetime object Question: So in Python 3, you can generate an ISO 8601 date with .isoformat(), but you can’t convert a string created by isoformat() back into a datetime object because Python’s own datetime directives don’t match properly. That is, %z = 0500 instead of 05:00 (which …

Total answers: 2

Converting ISO 8601 date time to seconds in Python

Converting ISO 8601 date time to seconds in Python Question: I am trying to add two times together. The ISO 8601 time stamp is ‘1984-06-02T19:05:00.000Z’, and I would like to convert it to seconds. I tried using the Python module iso8601, but it is only a parser. Any suggestions? Asked By: Zaynaib Giwa || Source Answers: …

Total answers: 3

How to convert a timezone aware string to datetime in Python without dateutil?

How to convert a timezone aware string to datetime in Python without dateutil? Question: I have to convert a timezone-aware string like “2012-11-01T04:16:13-04:00” to a Python datetime object. I saw the dateutil module which has a parse function, but I don’t really want to use it as it adds a dependency. So how can I …

Total answers: 7

Convert timestamps with offset to datetime obj using strptime

Convert timestamps with offset to datetime obj using strptime Question: I am trying to convert time-stamps of the format “2012-07-24T23:14:29-07:00” to datetime objects in python using strptime method. The problem is with the time offset at the end(-07:00). Without the offset i can successfully do time_str = “2012-07-24T23:14:29” time_obj=datetime.datetime.strptime(time_str,’%Y-%m-%dT%H:%M:%S’) But with the offset i tried …

Total answers: 4

Convert an RFC 3339 time to a standard Python timestamp

Convert an RFC 3339 time to a standard Python timestamp Question: Is there an easy way to convert an RFC 3339 time into a regular Python timestamp? I’ve got a script which is reading an ATOM feed and I’d like to be able to compare the timestamp of an item in the ATOM feed to …

Total answers: 15