Last updated
ISO 8601 Formatter Examples
The ISO 8601 Formatter converts dates, times, datetimes, durations, and intervals to and from the international standard format. Below are examples covering all major ISO 8601 variants with timezone handling.
Basic Date Format
ISO 8601 date format: YYYY-MM-DD
Examples:
2024-01-15 → January 15, 2024
2024-12-31 → December 31, 2024
2000-02-29 → February 29, 2000 (leap year)
Human-readable → ISO 8601:
January 15, 2024 → 2024-01-15
15/01/2024 → 2024-01-15
01/15/2024 → 2024-01-15
15-Jan-2024 → 2024-01-15
Time Format
ISO 8601 time format: HH:MM:SS
Basic:
14:30:00 → 2:30 PM
09:05:03 → 9:05:03 AM
00:00:00 → Midnight
23:59:59 → One second before midnight
With fractional seconds:
14:30:00.000 → milliseconds (3 decimal places)
14:30:00.000000 → microseconds (6 decimal places)
14:30:00.123456789 → nanoseconds (9 decimal places)
With timezone:
14:30:00Z → 14:30 UTC
14:30:00+05:30 → 14:30 India Standard Time (UTC+5:30)
14:30:00-05:00 → 14:30 Eastern Standard Time (UTC-5)
14:30:00+00:00 → 14:30 UTC (explicit offset)
Combined Datetime Format
ISO 8601 datetime: YYYY-MM-DDTHH:MM:SSZ
Examples:
2024-01-15T14:30:00Z
→ January 15, 2024 at 2:30 PM UTC
2024-01-15T14:30:00+05:30
→ January 15, 2024 at 2:30 PM IST (India)
2024-01-15T09:00:00-05:00
→ January 15, 2024 at 9:00 AM EST (US Eastern)
2024-01-15T14:30:00.123Z
→ January 15, 2024 at 2:30:00.123 PM UTC (with milliseconds)
Human-readable → ISO 8601:
"Jan 15, 2024 2:30 PM UTC" → 2024-01-15T14:30:00Z
"15/01/2024 14:30" → 2024-01-15T14:30:00
Timezone Conversion
Convert 2024-01-15T14:30:00Z to different timezones:
UTC: 2024-01-15T14:30:00Z
New York (EST): 2024-01-15T09:30:00-05:00
London (GMT): 2024-01-15T14:30:00+00:00
Paris (CET): 2024-01-15T15:30:00+01:00
Dubai (GST): 2024-01-15T18:30:00+04:00
Mumbai (IST): 2024-01-15T20:00:00+05:30
Singapore (SGT): 2024-01-15T22:30:00+08:00
Tokyo (JST): 2024-01-15T23:30:00+09:00
Sydney (AEDT): 2024-01-16T01:30:00+11:00
Duration Format
ISO 8601 duration: P[n]Y[n]M[n]DT[n]H[n]M[n]S
Examples:
P1Y → 1 year
P6M → 6 months
P3D → 3 days
PT4H → 4 hours
PT30M → 30 minutes
PT45S → 45 seconds
P1Y2M3DT4H5M6S → 1 year, 2 months, 3 days, 4 hours, 5 minutes, 6 seconds
P0Y0M0DT0H30M0S → 30 minutes (verbose form)
PT1H30M → 1 hour 30 minutes
Human-readable → ISO 8601 duration:
"2 hours and 30 minutes" → PT2H30M
"1 year, 6 months" → P1Y6M
"90 days" → P90D
"1 week" → P7D (ISO 8601 also allows P1W)
Week Date Format
ISO 8601 week date: YYYY-Www-D
Format: Year - Week number - Day of week (1=Monday, 7=Sunday)
Examples:
2024-W03-1 → Monday, January 15, 2024 (week 3)
2024-W03-5 → Friday, January 19, 2024
2024-W01-1 → Monday, January 1, 2024 (first week)
2024-W52-7 → Sunday, December 29, 2024
Calendar date → Week date:
2024-01-15 → 2024-W03-1
2024-07-04 → 2024-W27-4 (Thursday)
2024-12-25 → 2024-W52-3 (Wednesday)
Ordinal Date Format
ISO 8601 ordinal date: YYYY-DDD
DDD = day number within the year (001–365, or 366 in leap years)
Examples:
2024-001 → January 1, 2024
2024-015 → January 15, 2024
2024-100 → April 9, 2024
2024-366 → December 31, 2024 (2024 is a leap year)
2023-365 → December 31, 2023 (non-leap year)
Calendar date → Ordinal:
2024-01-15 → 2024-015
2024-03-01 → 2024-061 (leap year: Jan 31 + Feb 29 + 1)
2024-12-31 → 2024-366
Time Interval Format
ISO 8601 interval formats:
Start/End:
2024-01-01T00:00:00Z/2024-01-31T23:59:59Z
→ January 2024 (full month)
Start/Duration:
2024-01-15T09:00:00Z/PT8H
→ 8-hour period starting January 15 at 9 AM UTC
Duration/End:
P30D/2024-01-31T23:59:59Z
→ 30 days ending January 31, 2024
Repeating interval:
R5/2024-01-01T00:00:00Z/P1M
→ Repeat 5 times, starting Jan 1, every 1 month
Validation Examples
Valid:
2024-02-29T12:00:00Z ✓ (2024 is a leap year)
2024-12-31T23:59:59Z ✓
P1Y2M3DT4H5M6S ✓
Invalid:
2023-02-29T12:00:00Z ✗ (2023 is not a leap year)
2024-13-01 ✗ (month 13 does not exist)
2024-01-15T25:00:00Z ✗ (hour 25 is invalid)
2024-01-15T14:60:00Z ✗ (minute 60 is invalid)
Common API Usage
// JavaScript: current time as ISO 8601
new Date().toISOString()
// → "2024-01-15T14:30:00.000Z"
// Python: current UTC time as ISO 8601
from datetime import datetime, timezone
datetime.now(timezone.utc).isoformat()
# → "2024-01-15T14:30:00.000000+00:00"
// SQL: store as ISO 8601 compatible timestamp
INSERT INTO events (created_at) VALUES ('2024-01-15T14:30:00Z');
Use the ISO 8601 Formatter to convert any date or time format to the standard, handle timezone offsets, parse durations, and validate datetime strings before using them in APIs or databases.