ISO 8601 is the International Standards Organization's standard for representing time as a string. It covers dates, times, timezones, durations, and many other things.
Questions tagged [iso8601]
911 questions
54
votes
2 answers
UTC vs ISO format for time
I'm trying to understand the difference between UTC and ISO formats and when to use what when transferring messages between servers. So When I try the following this is what I get
new Date().toISOString()
"2019-11-14T00:55:31.820Z"
new…

tmp dev
- 8,043
- 16
- 53
- 108
53
votes
4 answers
ISO 8601 String to Date/Time object in Android
I have a string in standard ISO 8601 format that contains the date/time returned from a web service like so:
String dtStart = "2010-10-15T09:27:37Z"
How do I get this into an object such as Time or Date? I initially want to output it in a different…

neildeadman
- 3,974
- 13
- 42
- 55
52
votes
5 answers
Why does Python 3 find this ISO8601 date: "2019-04-05T16:55:26Z" invalid?
I supply "2019-04-05T16:55:26Z" to Python 3's datetime.datetime.fromisoformat and get Invalid isoformat string, though the same string works without the Z. ISO8601 allows for the Z - https://en.wikipedia.org/wiki/ISO_8601
$ python3
Python 3.7.2…

stephendwolff
- 1,382
- 1
- 13
- 27
52
votes
3 answers
What's the difference between datetime in ISO 8601 and UTC formats in javascript?
I pick some date and time in javascript and then want to store it on server (.NET). Dates are supposed to be in future from the current moment (so they won't be before 1970).
Having read topics here on SO I learnt it's better to store date as a…

myroman
- 561
- 1
- 5
- 11
46
votes
2 answers
Identifying time zones in ISO 8601
No, I'm not talking about zone offsets --- those can vary during the year for a region based on e.g. DST. I'm talking about the actual time zones maintained by IANA. I understand these are not supported by ISO 8601, correct?
What are platforms doing…

Garret Wilson
- 18,219
- 30
- 144
- 272
46
votes
8 answers
Is there a simple way of converting an ISO8601 timestamp to a formatted NSDate?
If I use the following code:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm"];
NSDate *myDate = [dateFormatter dateFromString:@"2010-01-28T15:22:23.863"];
NSLog(@"%@",…

rson
- 1,455
- 2
- 24
- 43
43
votes
2 answers
How to parse ISO 8601 into date and time format using Moment js in Javascript?
I am currently using Moment js to parse an ISO 8601 string into date and time, but it is not working properly. What am I doing wrong? And I would take any other easier solutions as well.
The ISO 8601 I would like to parse: "2011-04-11T10:20:30Z"…

Walter
- 871
- 3
- 12
- 16
41
votes
4 answers
Java 8 Date and Time: parse ISO 8601 string without colon in offset
We try to parse the following ISO 8601 DateTime String with timezone offset:
final String input = "2022-03-17T23:00:00.000+0000";
OffsetDateTime.parse(input);
LocalDateTime.parse(input, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
Both approaches fail…

Ursin Brunner
- 2,310
- 1
- 24
- 24
40
votes
2 answers
Is there any kind of standard for representing date ranges?
ISO 8601 represents a date as YYYY-MM-DD.
It doesn't seem to offer any recommendation on how to represent a date range, for example:
2013-01-01 => 2013-06-31
Does ISO 8601, or another standard, give a sensible recommendation for representing date…

BenMorel
- 34,448
- 50
- 182
- 322
38
votes
4 answers
Windows ISO 8601 timestamp
I need to convert a date in Windows PowerShell to the ISO 8601 format.
In Linux/Unix it was no problem with
TZ=0 date -d "" +%Y-%m-%dT%H:%M:%S.000Z
Now I need to do the same in Windows PowerShell. The output format on Windows…

M.S.
- 485
- 1
- 4
- 7
37
votes
6 answers
How do I store an UTC ISO8601 date in a MySQL database?
I have thousands of dates in the following format:
2011-10-02T23:25:42Z (aka ISO 8601 in UTC)
What MySQL data type should I use for storing such a ISO8601 date in a MySQL database? E.g. Datetime, timestamp or something else?
Which is best for…

user967144
- 471
- 2
- 5
- 7
34
votes
9 answers
Convert ISO 8601 duration with JavaScript
How can I convert duration with JavaScript, for example:
PT16H30M

cvelinho
- 556
- 1
- 4
- 13
33
votes
3 answers
Converting ISO 8601 date time to seconds in Python
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?

Zaynaib Giwa
- 5,366
- 7
- 21
- 26
33
votes
9 answers
Java SimpleDateFormat pattern for W3C XML dates with timezone
I am trying to parse a W3C XML Schema date like the following
"2012-05-15T07:08:09+03:00"
which complies with the ISO 8601 version of the W3C XML Schema dateTime specification.
In the above date, the timezone identifier is "+03:00", but no…

PNS
- 19,295
- 32
- 96
- 143
32
votes
5 answers
Parse and create ISO 8601 Date and time intervals, like PT15M in PHP
A library and webservice I am using communicates time-intervals in ISO 8601 format: PnYnMnDTnHnMnS. I want to convert such formats to seconds. And vice versa. Seconds are a lot easier to calculate with.
Example interval values are:
PT1M or PT60S…

berkes
- 26,996
- 27
- 115
- 206