ISO8601 time string with a Z comes out with +00:00 after load and then dump
See original GitHub issueWhen using the fields.DateTime
and a value "2018-07-25T00:00:00Z"
. Loading and then dumping that data should result in the exact same value for that field. But it doesn’t. What is dumped back out is "2018-07-25T00:00:00+00:00"
. This is not technically a different time, but I think I should be able to serialize/deserialize data and not have it be altered from the voyage.
datetime strings are really difficult with python. My sympathies.
I’m going to try to make a subclass of field that does only what I want for tz-aware iso8601 strings and isn’t as broad as fields.DateTime
. I’ll post it back for reference.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ISO 8601 date-time format combining 'Z' and offset of '+0000'
No, not OK. No, the Z is an offset-from-UTC so it should not be combined redundantly with a numerical offset of +00:00 or...
Read more >TO_UTC_TIMESTAMP_TZ - Oracle Help Center
The SQL function TO_UTC_TIMESTAMP_TZ takes an ISO 8601 date format string as the varchar input and returns an ... Z specifies UTC time...
Read more >Class: Time (Ruby 2.6.3)
It can be an offset from UTC, given either as a string such as “+09:00” or as a number of seconds such as...
Read more >A simple PHP API extension for DateTime. - Carbon
Carbon - A simple PHP API extension for DateTime.
Read more >strptime: Date-time Conversion Functions to and from Character
A character string specifying the time zone to be used for the conversion. ... exception strings such as 24:00:00 are accepted for input,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is the same value with different encodings.
Z
and+00:00
are equivalent.dateutil
’sparser
is passing the timezone correctly anddatetime.isoformat()
is allowed to representZ
as+00:00
. If you are interfacing with a system that doesn’t accept+00:00
as a timezone, it probably isn’t compliant. Otherwise it is a personal preference that can be achieved with a custom format.Given the current design, there isn’t a good way outside of passing
format
toDateTime
that ensures that the input and output format are exactly the same. If you need more complex logic thatformat
, a custom field is the way to go.