Reputation: 12423
I am using api it require date as this format
2020-03-01T00:00:00Z
I googled around and couldn't under stand what the T
Z
means.
For Now I made this string with this code by python
dt_now.strftime('%Y-%m-%dT%H:%M:%SZ')
However it looks a bit awkward and I am not sure if it is correct.
Is there any good way for python datetime??
Upvotes: 2
Views: 4884
Reputation: 75629
This looks like ISO 8601 time format. The T
stands for time
and is used as separator, while Z
determines time offset and stands for Zulu
which is commonly used, military originated, name alias for UTC+0 offset. For other offsets you need to specify it as HH:MM
, with +
or -
respectively. So the Z
is therefore equivalent of writing +00:00
.
See https://en.wikipedia.org/wiki/ISO_8601 for more info.
Upvotes: 5