Date Format Converter

Convert a date between ISO 8601, RFC 2822, Unix time and the US and EU formats that make 03/04 ambiguous. The custom pattern box covers the cases where the system on the other end wants a format no standard covers.

Accepts ISO, RFC 2822, date text and Unix timestamps.
Detected Date
Waiting for input...
Result
-
Common Formats

1 Date Format Converter supported formats

Standards

ISO 8601, RFC 2822 and Unix timestamps, in seconds or milliseconds.

Regional

US (MM/DD/YYYY) and EU (DD/MM/YYYY) on output. On input, 25/12/2023 is not recognized, because JavaScript reads slashed dates month first.

2 Date Format Converter example

Date Formats

1
2
3
4
5
6
7
8
// ISO 8601
2023-12-25T14:30:00Z

// RFC 2822
Mon, 25 Dec 2023 14:30:00 +0000

// Unix Timestamp
1703514600

3 Custom Formatting

Type a Day.js pattern into the Custom Format box and wrap literal text in square brackets, as in DD MMM YYYY [at] HH:mm. The common tokens:

  • YYYY: full year
  • MM: month (01 to 12)
  • MMM: month name (Jan to Dec)
  • DD: day (01 to 31)
  • HH: hour (00 to 23)
  • mm: minute (00 to 59)
  • ss: second (00 to 59)

How to use the Date Format Converter tool

  1. Type or paste a date into Input Date, for example 2023-12-25T14:30:00Z, Dec 25 2023 or 1703514600. Click Use current time to fill it with the present moment as an ISO string.
  2. The preview under the input shows the parsed date in your local zone, or "Invalid Date" in red if it could not be understood.
  3. Read the output cards: ISO 8601, RFC 2822 (Email), US Date, EU / UK Date, SQL Timestamp and Unix Timestamp (ms). Each card has a Copy button.
  4. Enter a Day.js pattern in the Custom Format box, such as DD MMM YYYY [at] HH:mm, and the result updates as you type.
  5. Click Clear to reset the input and every output.

How to convert between date formats in JavaScript, PHP and Python

JavaScript / Node.js

const input = "2023-12-25T14:30:00Z";
const d = new Date(input);

if (isNaN(d)) throw new Error("Invalid Date");

console.log(d.toISOString());   // 2023-12-25T14:30:00.000Z (always UTC)
console.log(d.toUTCString());   // Mon, 25 Dec 2023 14:30:00 GMT (RFC 7231 style)
console.log(d.getTime());       // 1703514600000 (milliseconds)

// Custom pattern such as YYYY-MM-DD HH:mm:ss in UTC
const pad = (n) => String(n).padStart(2, "0");
console.log(
  `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ` +
  `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`
);

// Locale-aware output in a specific time zone
console.log(new Intl.DateTimeFormat("en-GB", {
  dateStyle: "full", timeStyle: "long", timeZone: "Asia/Jakarta",
}).format(d));

With Day.js installed, dayjs(input).format("DD MMM YYYY HH:mm") gives the same tokens the tool uses.

PHP

<?php
// Parse a known pattern strictly
$d = DateTime::createFromFormat("d/m/Y H:i", "25/12/2023 14:30", new DateTimeZone("UTC"));
if ($d === false) {
    die("Invalid date");
}

echo $d->format(DATE_ATOM), PHP_EOL;     // 2023-12-25T14:30:00+00:00 (ISO 8601)
echo $d->format(DATE_RFC2822), PHP_EOL;  // Mon, 25 Dec 2023 14:30:00 +0000
echo $d->format("Y-m-d H:i:s"), PHP_EOL; // SQL style
echo $d->getTimestamp(), PHP_EOL;        // 1703514600

// Convert to another zone
$d->setTimezone(new DateTimeZone("America/New_York"));
echo $d->format("D, d M Y H:i T"), PHP_EOL; // Mon, 25 Dec 2023 09:30 EST

// Free-form parsing (less strict, but handy)
echo (new DateTime("next monday 09:00", new DateTimeZone("UTC")))->format("c"), PHP_EOL;

createFromFormat() fills unspecified fields with the current time. Add ! at the start of the pattern to zero them.

Python

from datetime import datetime, timezone
from email.utils import format_datetime
from zoneinfo import ZoneInfo

# Parse a known pattern
d = datetime.strptime("25/12/2023 14:30", "%d/%m/%Y %H:%M").replace(tzinfo=timezone.utc)

print(d.isoformat())                      # 2023-12-25T14:30:00+00:00
print(format_datetime(d))                 # Mon, 25 Dec 2023 14:30:00 +0000 (RFC 2822)
print(d.strftime("%Y-%m-%d %H:%M:%S"))    # SQL style
print(int(d.timestamp()))                 # 1703514600

# Parse ISO 8601 (Python 3.11+ accepts the trailing Z)
iso = datetime.fromisoformat("2023-12-25T14:30:00+00:00")

# Convert to another zone
print(iso.astimezone(ZoneInfo("Asia/Tokyo")).strftime("%d %b %Y %H:%M %Z"))

zoneinfo ships with Python 3.9+. On Windows, install the tzdata package to get the zone database.

Common errors and how to fix them

Invalid Date
The parser did not recognize the string. Day-first formats such as 25/12/2023 fail in JavaScript, because it reads slashed dates month first. Use ISO 8601 (YYYY-MM-DD), or parse with an explicit pattern such as dayjs(str, "DD/MM/YYYY").
The date is one day earlier than the input
A date-only string such as 2023-12-25 is parsed as midnight UTC. In a zone behind UTC, that instant is the evening of 24 December. Add a time and an offset, or display the value in UTC.
Output shows 1703514600000 instead of 1703514600
The Unix Timestamp card is in milliseconds, matching JavaScript. Divide by 1000 for seconds, which PHP, Python and most databases expect.
RangeError: Invalid time value when calling toISOString()
The Date object is invalid, so formatting throws. Check isNaN(date) after parsing, and validate user input before you format it.
Custom format prints the token names instead of values
The pattern uses strftime codes such as %Y or PHP codes such as Y-m-d. The Custom Format box uses Day.js tokens: YYYY, MM, DD, HH, mm, ss. Wrap literal text in square brackets.

Good to know

Store and transmit ISO 8601 (2023-12-25T14:30:00Z). It sorts correctly as plain text, carries its offset, and every language parses it without a library. RFC 2822 (Mon, 25 Dec 2023 14:30:00 +0000) survives in email headers and older HTTP code. Treat locale strings like 12/25/2023 as display only, because the same digits mean a different day in another country.

The tool runs Day.js with the utc, customParseFormat and advancedFormat plugins. Input without an offset is read in your browser's zone, and every card shows the same instant. On another machine the local cards change, but the ISO and Unix values do not. The timezone plugin is not loaded, so to render a third zone, use Intl.DateTimeFormat or one of the snippets above.

Specifications and references

This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.

Guides and tutorials

Frequently Asked Questions

Which input formats are recognized?

ISO 8601, RFC 2822, Unix timestamps in seconds or milliseconds, and common text formats such as 12/31/2025 or 31 Dec 2025 14:30. Day-first dates such as 31/12/2025 are not recognized, because JavaScript reads slashed dates month first. Click Use current time to start from the present moment.

Can I define a custom output format?

Yes. Type a pattern into Custom Format using tokens such as YYYY, MM, DD, HH, mm and ss, and wrap literal text in square brackets. For example, DD MMM YYYY [at] HH:mm gives 25 Dec 2023 at 14:30.

How is the time zone handled?

Input without an offset is read in your browser's local time zone. The ISO 8601 and RFC 2822 cards show UTC, and the US, EU and SQL cards show local time. To convert between two named zones, use the time zone converter.

Why does my date shift by a day?

A date-only string such as 2023-12-25 is read as midnight UTC. In a zone behind UTC, that instant is still the evening of the day before. Add a time and an offset to remove the ambiguity.

Is this the same as dayjs or moment formatting?

Yes. The tool uses Day.js, so the format tokens match Day.js and Moment.js. They differ from PHP's date() codes and strftime's %Y-style codes.

Related

For epoch seconds specifically, the Unix timestamp converter shows UTC and local side by side. If the date is going into a schedule, the cron generator is next.

More Date & Time Tools

Browse all date & time tools

Copied to clipboard!