[python] What exactly does the T and Z mean in timestamp?

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 in python?

Sorry if this is painfully obvious, but Google was not very helpful and neither was the strftime() reference page.

I am currently using this :

x.strftime("%Y-%m-%dT%H:%M:%S%Z")
'2015-03-26T10:58:51'

This question is related to python datetime timestamp strftime rfc3339

The answer is


The T doesn't really stand for anything. It is just the separator that the ISO 8601 combined date-time format requires. You can read it as an abbreviation for Time.

The Z stands for the Zero timezone, as it is offset by 0 from the Coordinated Universal Time (UTC).

Both characters are just static letters in the format, which is why they are not documented by the datetime.strftime() method. You could have used Q or M or Monty Python and the method would have returned them unchanged as well; the method only looks for patterns starting with % to replace those with information from the datetime object.


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to datetime

Comparing two joda DateTime instances How to format DateTime in Flutter , How to get current time in flutter? How do I convert 2018-04-10T04:00:00.000Z string to DateTime? How to get current local date and time in Kotlin Converting unix time into date-time via excel Convert python datetime to timestamp in milliseconds SQL Server date format yyyymmdd Laravel Carbon subtract days from current date Check if date is a valid one Why is ZoneOffset.UTC != ZoneId.of("UTC")?

Examples related to timestamp

concat yesterdays date with a specific time How do I format {{$timestamp}} as MM/DD/YYYY in Postman? iOS Swift - Get the Current Local Time and Date Timestamp Pandas: Convert Timestamp to datetime.date Spark DataFrame TimestampType - how to get Year, Month, Day values from field? What exactly does the T and Z mean in timestamp? What does this format means T00:00:00.000Z? Swift - iOS - Dates and times in different format Convert timestamp to string Timestamp with a millisecond precision: How to save them in MySQL

Examples related to strftime

How to change the datetime format in pandas What exactly does the T and Z mean in timestamp? Convert python datetime to epoch with strftime Using %f with strftime() in Python to get microseconds Converting unix timestamp string to readable date YYYY-MM-DD format date in shell script Python strftime - date without leading 0?

Examples related to rfc3339

What exactly does the T and Z mean in timestamp? How can I parse / create a date time stamp formatted with fractional seconds UTC timezone (ISO 8601, RFC 3339) in Swift? Parse rfc3339 date strings in Python? How to convert a timezone aware string to datetime in Python without dateutil? How do I parse an ISO 8601-formatted date?