You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing a date with DateFormatter is you set the timeZone of the DateFormatter then the parsed date will be in that time zone. When parsing a date with ISO8601DateFormatter the timeZone parameter is ignored and the Date is always assumed to be UTC.
I believe the issue here is that you’re using a literal Z in your DateFormatter’s dateFormat. In ISO-8601, the Z indicates UTC. If you update your DateFormatter to be "yyyy-MM-dd'T'HH:mm:ssZZZZZ", both will give the same result:
When parsing a date with
DateFormatter
is you set the timeZone of theDateFormatter
then the parsed date will be in that time zone. When parsing a date withISO8601DateFormatter
the timeZone parameter is ignored and the Date is always assumed to be UTC.The output from the following code is
The text was updated successfully, but these errors were encountered: