EpochLab

Custom Date Formatter

Build a date format from tokens

Write a pattern in strftime or moment tokens and watch it render live, with a clickable reference and a set of presets to start from.

Questions people ask

The things that come up about custom date formatters, answered plainly.

What is the difference between strftime and moment tokens?

strftime uses percent-prefixed single letters — %Y-%m-%d — and comes from C, Python, Ruby and the shell. Moment-style uses repeated letters — YYYY-MM-DD — and comes from JavaScript. This page speaks both.

Why does YYYY sometimes give the wrong year?

You may have written a lowercase yyyy or a capital DDD by accident, but the classic trap is `YYYY` versus `GGGG`: the latter is the ISO week-numbering year, and around New Year they differ. Writing `GGGG-MM-DD` produces a date that is wrong for a few days every January.

Related tools

Render an instant in any pattern or locale, and read one back out of text.

All 160 tools · More in formatting & parsing