...
How to Use the Date Formatter
This tool simplifies converting dates and times into any format you need. Follow these simple steps:
- Enter Your Date: Type or paste any recognizable date and time into the "Date & Time Input" field. You can also click the calendar icon 📅 to pick a date.
- Specify a Format: In the "Target Format" field, enter the desired format using the tokens from the reference table below (e.g.,
YYYY-MM-DD
). Click into the field to see a dropdown of common presets. - Click Convert: Press the "Convert" button to generate the formatted date. The result will appear below the buttons.
- Copy Result: Click the copy icon inside the result box to instantly copy the text to your clipboard.
- Reset: Click the "Reset" button to clear the inputs and hide the result.
Date Format Characters
Characters | Output | Details |
---|---|---|
Weekday | ||
d | 0 | 0 to 6 number of day of the week where 0 is Sunday. |
dd | Su | First 2 letters of day. Example: Su for Sunday. |
ddd | Sun | First 3 letters of day. Example: Mon for Monday. |
dddd | Sunday | Complete name of day. |
Day | ||
D | 1 | 1 - 31 numeric calendar day of the month. |
Do | 1st | 1st - 31st ordinal calendar day of the month. |
DD | 01 | 01 - 31 zero-padded calendar day of the month. |
DDD | 336 | 1 - 366 calendar day of the year. |
DDDo | 336th | 1st - 366th ordinal calendar day of the year. |
DDDD | 336 | 001 - 366 zero-padded calendar day of the year. |
Month | ||
M | 12 | 1 - 12 numeric month. |
MM | 12 | 1 - 12 numeric month with zero padding. |
Mo | 12th | 1st - 12th ordinal month. |
MMM | Dec | First 3 letters of the month name. Example: Feb for February. |
MMMM | December | Full name of the month. |
Year | ||
Y | 2024 | Full year. |
YY | 24 | Last 2 digits of year. |
YYYY | 2024 | 4 digits of year. |
Week | ||
w | 49 | 1 - 53 week number of the year. |
ww | 49 | 01 - 53 zero-padded week of the year. |
wo | 49th | 1st - 53rd ordinal week of the year. |
Hours | ||
h | 7 | 1 - 12 of the 12 hours time format. |
hh | 07 | 01 - 12 zero-padded 12 hours time format. |
H | 19 | 0 - 23 of the 24 hours time format. |
HH | 19 | 01 - 23 zero-padded 24 hours time format. |
Minutes | ||
m | 30 | 0 - 59 minutes. |
mm | 30 | 00 - 59 zero-padded minutes. |
Seconds | ||
s | 9 | 0 - 59 seconds. |
ss | 09 | 00 - 59 zero-padded seconds. |
Meridiem | ||
a | pm | am/pm in small letters. |
A | PM | AM/PM in capital letters. |
Timezone | ||
Z | +06:00 | UTC offset. Example: +06:00. |
ZZ | +0600 | UTC offset without semicolon. Example: +0600. |
Commonly Used Date Formats
Format | Example Output |
---|---|
MMMM Do YYYY | December 1st 2024 |
Do MMMM YYYY | 1st December 2024 |
MMMM D, YYYY | December 1, 2024 |
MMMM Do YYYY, h:mm:ss a | December 1st 2024, 7:30:09 pm |
dddd, MMMM D, YYYY, h:mm:ss a | Sunday, December 1, 2024, 7:30:09 pm |
ddd, D MMM YYYY HH:mm:ss A | Sun, 1 Dec 2024 19:30:09 PM |
MM/DD/YYYY | 12/01/2024 |
YYYY-MM-DD | 2024-12-01 |
MMM D, YYYY | Dec 1, 2024 |
YYYY-MM-DDTHH:mm:ssZ | 2024-12-01T19:30:09+06:00 |
Date Format Standard (ISO 8601)
For developers and data analysts, consistent date formatting is critical. The ISO 8601 standard is the gold standard for representing dates and times. A format like YYYY-MM-DDTHH:mm:ssZ
is unambiguous, machine-readable, and sortable.
- Unambiguous: It eliminates confusion between formats like
MM/DD/YYYY
andDD/MM/YYYY
. - Sortable: Dates can be sorted chronologically as plain strings.
- Timezone-Aware: The `Z` at the end represents the UTC offset, making the timestamp globally understandable.
It's best practice to store all dates in UTC on the backend and convert them to the user's local timezone on the frontend for display. This tool helps you visualize and convert to and from this essential format.
Frequently Asked Questions (FAQ)
Why is my result "Invalid Date"?
This usually happens when the input date string is in a format our parser cannot automatically recognize. Try a more standard format like YYYY-MM-DD HH:mm:ss
or MM/DD/YYYY
. Using the calendar picker is the surest way to provide a valid input.
What is the difference between `m` and `M`?
Case matters! Lowercase m
is for minutes (0-59), while uppercase M
is for the month (1-12). Using the wrong one is a very common mistake that can lead to unexpected results.
How do I get ordinal numbers like "1st", "2nd", "3rd"?
Use the Do
token for the day of the month (e.g., "6th") or wo
for the week of the year (e.g., "35th"). For example, MMMM Do, YYYY
will output "July 6th, 2025".
Can I use literal text in my format?
Yes. To include characters that might otherwise be interpreted as format tokens, wrap them in square brackets. For example, the format [Today is] dddd, MMMM Do
will produce "Today is Sunday, July 6th". The brackets tell the parser to treat the words inside as literal strings.
What timezone is being used?
This tool uses the timezone of your local browser. The output reflects how the date would be interpreted on your computer. When you use a timezone format token like Z
, it will show your browser's current offset from UTC.