🔬 Format Lab

Paste any timestamp and see how different parsers interpret it. Discover the subtle differences between RFC 3339, ISO 8601, and locale-specific parsing that can break your code.

Quick examples:

🟨 JavaScript Parsers

new Date()

valid
2024-03-10T14:30:00.000Z
UTC: Sun, 10 Mar 2024 14:30:00 GMT

Luxon DateTime

valid
2024-03-10T14:30:00.000Z
UTC: 2024-03-10T14:30:00Z

Day.js

valid
2024-03-10T14:30:00.000Z
UTC: 2024-03-10T14:30:00Z

🐍 Python & Others

Python datetime

valid
datetime(2024-03-10 14:30:00)

Go time.Parse

valid
time.Parse(time.RFC3339, "2024-03-10T14:30:00Z")

Java Instant

valid
Instant.parse("2024-03-10T14:30:00Z")

📋 Format Analysis

Detected Format
YYYY-MM-DDTHH:mm:ss.sssZ
Standard
RFC 3339 / ISO 8601
Timezone Info
UTC (Z suffix)
Precision
Seconds
Compatibility
High
Risk Level
Low

💡 Recommendations

  • Excellent choice! This format is widely supported.

Safe Parsing Examples

// ❌ Avoid: Native Date constructor can be unpredictable
const badDate = new Date("2024-03-10T14:30:00Z");

// ✅ Better: Use Luxon for reliable parsing
import { DateTime } from 'luxon';

const dt = DateTime.fromISO("2024-03-10T14:30:00Z");
if (dt.isValid) {
  console.log('Parsed:', dt.toISO());
  console.log('UTC:', dt.toUTC().toISO());
  console.log('Local:', dt.toLocal().toISO());
} else {
  console.error('Invalid date:', dt.invalidReason);
}

// ✅ Alternative: Day.js with timezone plugin
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
dayjs.extend(utc);
dayjs.extend(timezone);

const parsed = dayjs("2024-03-10T14:30:00Z");
if (parsed.isValid()) {
  console.log('Parsed:', parsed.toISOString());
  console.log('UTC:', parsed.utc().format());
  console.log('Local:', parsed.tz(dayjs.tz.guess()).format());
} else {
  console.error('Invalid date');
}