JavaScript Date Formatter
Format any date with Intl.DateTimeFormat locale styles or custom tokens — instantly see ISO 8601, Unix timestamp, and relative time
Date & Options
Long (en-US)
March 30, 2026 at 6:27:43 PM GMT+8
Full month name, day, year (and time)
All Formats
Locale Comparison — Long style
Showing top 10 locales. Select a locale above to see its full output.
JavaScript Code
const date = new Date("2026-03-30T10:27:43.000Z");
// Locale-aware formatting with Intl.DateTimeFormat
const formatter = new Intl.DateTimeFormat("en-US", {
dateStyle: "long",
timeStyle: "long"
});
const formatted = formatter.format(date);
// → "March 30, 2026 at 6:27:43 PM GMT+8"
// ISO 8601
const iso = date.toISOString();
// → "2026-03-30T10:27:43.000Z"
// Unix timestamp (seconds)
const unixSec = Math.floor(date.getTime() / 1000);
// → 1774866463
// Relative time
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
// rtf.format(-3, "hour") → "3 hours ago"Your app needs to display “March 11, 2026” for US users, “11 Mars 2026” for French users, and “2026年3月11日” for Japanese users — all from the same Date object. You could install Moment.js (300KB), day.js (7KB), or date-fns — or you could use the browser’s built-in Intl.DateTimeFormat, which handles locale-aware formatting with zero dependencies. But the API options (dateStyle, timeStyle, hour12, timeZone) have enough combinations that you need to see the output before committing to a format.
Why This Tool (Not the Epoch Converter)
PureDevTools has an Epoch Converter for converting between Unix timestamps and human-readable dates. This tool is for formatting — explore Intl.DateTimeFormat options across 20+ locales, try custom patterns (YYYY-MM-DD HH:mm:ss), and see ISO 8601, Unix timestamp, UTC, and relative time output simultaneously. Everything runs in your browser; no data is sent anywhere.
What Is the JavaScript Date Formatter?
The JavaScript Date Formatter is an interactive tool for formatting dates using JavaScript’s built-in Intl.DateTimeFormat API and custom pattern tokens. Pick any date, select a locale, choose a format style (full, long, medium, short), or write your own pattern using tokens like YYYY-MM-DD HH:mm:ss. The tool also shows the ISO 8601 string, Unix timestamp, UTC representation, and relative time — all the formats developers encounter daily.
JavaScript’s Intl.DateTimeFormat is the standard API for locale-aware date formatting. It respects local conventions: month-day-year in the US, day-month-year in Europe, and year-month-day in East Asian locales — all handled automatically.
How to Use This Tool
- Pick a date — use the date-time picker or choose a preset (Now, Today Start, Unix Epoch, Y2K)
- Select a locale — choose from 20 locales including en-US, de-DE, ja-JP, zh-CN, ko-KR, and more
- Choose a format style — Full, Long, Medium, or Short for locale-aware formatting
- Or use a custom pattern — switch to Custom Pattern and type tokens like
YYYY-MM-DD HH:mm:ss - Toggle time inclusion — show or hide the time component in locale-aware formats
- Copy any output — one-click copy for formatted dates, ISO strings, and timestamps
Intl.DateTimeFormat Styles
JavaScript’s Intl.DateTimeFormat supports four built-in date styles, all fully locale-aware:
| Style | en-US Example | de-DE Example | ja-JP Example |
|---|---|---|---|
| full | Wednesday, January 1, 2025 | Mittwoch, 1. Januar 2025 | 2025年1月1日水曜日 |
| long | January 1, 2025 | 1. Januar 2025 | 2025年1月1日 |
| medium | Jan 1, 2025 | 01.01.2025 | 2025/01/01 |
| short | 1/1/25 | 1.1.25 | 2025/01/01 |
The same dateStyle option produces culturally appropriate output in each locale — the API handles month names, ordering, and separators automatically.
const date = new Date("2025-01-01T09:00:00");
// Locale-aware formatting
new Intl.DateTimeFormat("en-US", { dateStyle: "full" }).format(date);
// → "Wednesday, January 1, 2025"
new Intl.DateTimeFormat("de-DE", { dateStyle: "full" }).format(date);
// → "Mittwoch, 1. Januar 2025"
new Intl.DateTimeFormat("ja-JP", { dateStyle: "long", timeStyle: "short" }).format(date);
// → "2025年1月1日 9:00"
Custom Pattern Tokens
Switch to Custom Pattern mode to build your own format string using these tokens:
| Token | Description | Example |
|---|---|---|
YYYY | 4-digit year | 2025 |
YY | 2-digit year | 25 |
MMMM | Full month name | January |
MMM | Abbreviated month | Jan |
MM | Month (zero-padded) | 01 |
M | Month (no padding) | 1 |
DD | Day (zero-padded) | 05 |
D | Day (no padding) | 5 |
dddd | Full weekday name | Wednesday |
ddd | Abbreviated weekday | Wed |
HH | 24-hour hours (padded) | 09 |
H | 24-hour hours | 9 |
hh | 12-hour hours (padded) | 09 |
h | 12-hour hours | 9 |
mm | Minutes (padded) | 05 |
ss | Seconds (padded) | 08 |
SSS | Milliseconds (padded) | 042 |
A | AM/PM uppercase | AM |
a | am/pm lowercase | am |
X | Unix seconds | 1735689600 |
x | Unix milliseconds | 1735689600000 |
Z | UTC offset | +05:30 |
Common Pattern Examples
YYYY-MM-DD → 2025-01-01 (ISO date)
YYYY-MM-DD HH:mm:ss → 2025-01-01 09:00:00
DD/MM/YYYY → 01/01/2025 (European style)
MM/DD/YYYY → 01/01/2025 (US style)
MMM D, YYYY → Jan 1, 2025
dddd, MMMM D, YYYY → Wednesday, January 1, 2025
YYYY-MM-DDTHH:mm:ss → 2025-01-01T09:00:00
D MMMM YYYY [at] h:mm A → 1 January 2025 at 9:00 AM
ISO 8601 — The Universal Date Format
ISO 8601 is the international standard for date and time representation. It eliminates ambiguity by always ordering from largest unit to smallest (year → month → day → hour → minute → second):
Date only: 2025-01-01
Date and time: 2025-01-01T09:00:00
With timezone: 2025-01-01T09:00:00+05:30
UTC (Zulu time): 2025-01-01T04:30:00.000Z
JavaScript’s Date.prototype.toISOString() always returns UTC in the full format:
new Date("2025-01-01T09:00:00").toISOString();
// → "2025-01-01T04:30:00.000Z" (if local timezone is UTC+5:30)
When to use ISO 8601:
- Storing dates in databases (always use ISO 8601 UTC)
- API request/response payloads (JSON convention)
- Log files and audit trails
- Sorting: ISO 8601 strings sort lexicographically in chronological order
Unix Timestamps
A Unix timestamp is the number of seconds elapsed since January 1, 1970 00:00:00 UTC (the Unix epoch). It’s timezone-independent — the same number represents the same instant everywhere on Earth.
// Get current Unix timestamp in seconds
Math.floor(Date.now() / 1000); // → 1735689600
// Get milliseconds (JavaScript's native unit)
Date.now(); // → 1735689600000
// Convert back to Date
new Date(1735689600 * 1000); // → 2025-01-01T00:00:00.000Z
new Date(1735689600000); // → 2025-01-01T00:00:00.000Z
Unix seconds vs milliseconds:
- Unix seconds (10-digit):
1735689600— used by POSIX, databases, most APIs - Unix milliseconds (13-digit):
1735689600000— JavaScript’s nativeDate.now()unit
Relative Time
Relative time (“3 hours ago”, “2 days from now”) communicates dates intuitively. JavaScript’s Intl.RelativeTimeFormat API provides this natively:
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
rtf.format(-3, "hour"); // → "3 hours ago"
rtf.format(2, "day"); // → "in 2 days"
rtf.format(-1, "week"); // → "last week"
rtf.format(1, "month"); // → "next month"
Choosing the right unit: The display unit should match how a user thinks about the distance. A date 25 hours in the past feels like “yesterday” (days), not “25 hours ago” (hours). The formatter picks the most intuitive unit automatically.
Timezone Handling in JavaScript
JavaScript Date objects store time as milliseconds since the Unix epoch (always UTC internally). The local timezone only affects display:
// Same moment, different representations
const d = new Date("2025-01-01T12:00:00Z");
d.toISOString(); // "2025-01-01T12:00:00.000Z" (UTC)
d.toLocaleDateString(); // "1/1/2025" (local timezone)
d.getHours(); // local hours (varies by timezone)
d.getUTCHours(); // 12 (always UTC)
Common pitfalls:
new Date("2025-01-01")is treated as UTC midnight — may display as Dec 31 in UTC- timezonesnew Date("2025-01-01T00:00:00")is treated as local midnight — timezone-aware- Always store and transmit in UTC; convert to local time only for display
Using Intl.DateTimeFormat in JavaScript
// Basic usage
const formatter = new Intl.DateTimeFormat("en-US", {
dateStyle: "long",
timeStyle: "short",
});
formatter.format(new Date()); // "January 1, 2025 at 9:00 AM"
// Manual options (for more control)
const detailed = new Intl.DateTimeFormat("de-DE", {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
timeZone: "Europe/Berlin",
});
detailed.format(new Date()); // "Mittwoch, 1. Januar 2025, 09:00"
// Format parts (for styling individual components)
new Intl.DateTimeFormat("en-US").formatToParts(new Date());
// → [{ type: "month", value: "1" }, { type: "literal", value: "/" }, ...]
Frequently Asked Questions
What is the difference between Date.parse() and new Date()?
Both accept date strings, but behavior differs for ambiguous formats. new Date("2025-01-01") treats it as UTC midnight (ISO format). new Date("January 1, 2025") treats it as local midnight. The safest approach: always use ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ) for unambiguous parsing.
Why does toISOString() show a different date than I entered?
toISOString() always outputs UTC. If your local timezone is UTC-5 and you create new Date("2025-01-01T00:00:00") (local midnight), toISOString() outputs 2025-01-01T05:00:00.000Z (UTC). This is correct — the same instant, different timezone representation.
What is the ISO week number?
ISO 8601 defines weeks as starting on Monday, with week 1 being the week containing the year’s first Thursday. Week 53 can occur in years where January 1 falls on Thursday, or in leap years where January 1 falls on Wednesday.
How do I format a date without a library like Moment.js or date-fns?
Modern JavaScript provides everything you need natively: Intl.DateTimeFormat for locale-aware formatting, Intl.RelativeTimeFormat for relative time, and Date.prototype.toISOString() for ISO 8601. Libraries like Moment.js are now in maintenance mode; the Temporal API (Stage 3) will provide even more capabilities natively.
What is the Temporal API?
The Temporal API is a modern date/time JavaScript API proposed to replace the legacy Date object. It features immutable objects, explicit timezone handling, and ISO calendar support. As of 2025, it’s Stage 3 TC39 proposal with growing browser support via polyfills. Intl.DateTimeFormat already works alongside Temporal.
Is this tool safe for real production dates?
Yes. All processing runs in your browser — no date data is sent to any server. The tool uses JavaScript’s built-in Intl.DateTimeFormat API, the same engine your browser uses natively.