strftime · moment · luxon · Intl · reference

Every date-format token in one table

Pair each output example (e.g. January, 14, +0500) with the right token across strftime, Moment.js, Luxon, and Intl.DateTimeFormat.

Date Format Cheatsheet
Rows
18
tokens
Systems
4
strftime · moment · luxon · Intl
Coverage
common
everyday
Mode
reference
static
Referencestrftime · Moment.js · Luxon · Intl.DateTimeFormat
input · how to read
Layout
Each row shows the same date part across four formatting systems. Pick the column for your stack.
Tip
If you're migrating from Moment to Luxon, just walk down those two columns.
output · token table
ExamplestrftimeMoment.jsLuxonIntl.DateTimeFormat
2024%YYYYYyyyynumeric (year)
24%yYYyy2-digit (year)
January%BMMMMMMMMlong (month)
Jan%bMMMMMMshort (month)
01%mMMMM2-digit (month)
1%-mMMnumeric (month)
07%dDDdd2-digit (day)
7%-dDdnumeric (day)
Monday%AddddEEEElong (weekday)
Mon%adddEEEshort (weekday)
14%HHHHH2-digit (hour 24h)
2%-Ihhnumeric (hour 12h)
05%Mmmmm2-digit (minute)
30%Sssss2-digit (second)
PM%pAalong/short (dayPeriod)
001-366%jDDDDooo—
+0500%zZZZZZshortOffset
EST%ZzZZZZshort (timezone)
Quick Start

How to use the table

Find the date part you want (e.g. "PM"), then pick the column matching the library you use. Copy the token directly into your format string.

  1. 01

    Find the part

    Scan the Example column for the bit you want to format.

    Parsing accepts ISO 8601, RFC 3339, RFC 2822, and Unix epoch seconds/milliseconds. The Date constructor handles the rest with browser-engine consistency.

    findISO 8601RFC 3339epochlive
    row · timestampex · ISO
    "Monday"
    loaded · ISO 8601zone · ready
  2. 02

    Pick library

    strftime for Python/Ruby/C; Moment/Luxon for JS; Intl for native.

    All math runs in UTC internally to avoid DST landmines; presentation converts back to the user’s zone via Intl.DateTimeFormat.

    libUTC mathIntlDST-safelive
    col · optionslib · live
    Moment: dddd
    options applied · UTCDST-safe
  3. 03

    Paste token

    Drop the token into your format string.

    Output respects the chosen timezone offset (Z vs +05:30) and pads digits per ISO conventions so sorts stay chronological.

    useoffsetzone-awaresortablepadded
    → · computedfmt · ready
    "dddd, MMM D"
    computed · instantsortable
  4. 04

    Compare across

    Use the row to translate between libraries during migrations.

    Copy writes via the Async Clipboard API; nothing pings a time server — the browser’s clock is the only oracle.

    migrateclipboardno oracledeterministicclient-side
    ✓ · copiedready · done
    ✓ matched
    shipped · ready to shipsuccess
Pro tips

Time math without DST landmines

Always store UTC

Convert to local for display only. UTC storage avoids DST jumps and timezone drift in databases.

Watch leap seconds

POSIX time doesn’t count leap seconds; some systems do. Don’t use timestamps for sub-second precision across boundaries.

Prefer Temporal eventually

The Date API has many quirks. Temporal is shipping in modern engines and handles zones correctly.

Cron is timezone-tricky

Cron expressions run in the daemon’s local zone unless told otherwise. Pin a TZ explicitly for predictable runs.

ISO 8601 sorts naturally

YYYY-MM-DDTHH:mm:ss sorts correctly as a string. Don’t use US-style MM/DD/YYYY for anything machine-readable.

Beware Y2K38

Signed 32-bit Unix timestamps overflow in 2038. Use 64-bit storage end-to-end for long-lived systems.

Use Cases

When the cheatsheet helps

Migrations, docs, reviews.

Moment → Luxon

Translate every format string in one pass. Math runs in UTC under the hood to dodge DST jumps — local time is only for display. That means scheduling logic and date diffs survive March / November fall-back without the classic off-by-one-hour bug.

DST-safe

Cross-stack docs

Document the same date format for Python and JS teams. Browser clock is the only source — no external time server, no privacy leak, no rate limit. Pair with NTP-synced server time for high-accuracy use cases, but for human-scale work the browser clock is plenty.

UTC-correct

PR reviews

Spot a wrong %m vs MM in seconds. ISO 8601 output sorts naturally as strings, perfect for filenames (report-2026-01-15.pdf) and log lines that need chronological ordering without parsing. Drop into S3 keys for free time-bucketing.

ISO-sortable

Polyglot code

Format identically in shell, Python, Node. Pairs cleanly with cron, scheduled tasks, and timestamped log analysis. The tool's output drops directly into APScheduler, Linux cron, or GitHub Actions schedule expressions without re-formatting.

spec-grade

Onboarding

Hand new hires a one-page reference. Output respects the chosen timezone offset (Z vs +05:30) so REST APIs and database TIMESTAMP WITH TIME ZONE columns round-trip cleanly. No ambiguity between "noon UTC" and "noon local".

zone-aware

Localisation

Compare tokens that produce locale-sensitive output. Confirms the difference between epoch seconds (10 digits) and milliseconds (13 digits) before you commit code that mis-multiplies by 1000 — a classic bug in cross-language time handling.

i18n
FAQ

Frequently asked questions

Intl uses options objects (numeric, 2-digit, long, short), not single-letter tokens.
Linux-only strftime extension. Not portable enough to chart.
Yes — %-m / %#m differ on Linux vs Windows. Test before shipping.
Luxon uses its own tokens; the column maps them directly.
No. The table is static.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!