Date Format Codes Explained

What DD, MM, YYYY, MMM, DDMMYY, DD-MON-YYYY, %d/%m/%Y and hh:mm tt actually mean, and how to write the same date in every tool.

Last reviewed on 2 October 2026.

A date format code (also called a pattern, picture or format string) is a template that tells software how to write a date: DD for the day, MM for the month, YYYY for the year, and so on. The letters look universal, but they are not: mm is minutes in one tool and month in another, and YYYY can quietly mean a different year near New Year. Type any pattern into the tester below to see what it produces, then use the tables to translate it between Excel, Word, strftime, PHP, Java, .NET, JavaScript libraries and SQL. Every example on this page uses Friday 2 October 2026, 14:05:09.123.

Pattern tester

Type a pattern such as DD-MMM-YYYY, dd/mm/yyyy hh:mm, %d/%m/%Y or a Word field like { DATE \@ "dd.MM.yyyy" }. The output updates as you type.

Output

CodeMeaningOutput

How the tester reads codes: D and Y are case-insensitive. H is a 24-hour clock and h a 12-hour clock. M/m is read as minutes when it directly follows an hour code or directly precedes a seconds code (the same rule Excel uses), or when the pattern also contains uppercase MM for the month; otherwise it is the month. Text inside [brackets], 'single quotes' or "double quotes" is copied as-is. Patterns containing % codes are read as strftime.

Date format token reference

These are the building blocks used by most "human-readable" pattern styles (Excel, Moment, .NET and the generic notation found on forms). Upper/lower case matters in many tools; the cross-tool table below shows the exact letters each one expects.

TokenMeaningExample (2 Oct 2026, 14:05:09.123)
YYYY / yyyyYear, 4 digits2026
YY / yyYear, last 2 digits26
QQuarter of the year (1–4)4
MMMMMonth name, fullOctober
MMMMonth name, abbreviated (3 letters in English)Oct
MONMonth abbreviation, Oracle/SQL style (case follows the code)OCT
MMMonth number, 2 digits (leading zero)10
MMonth number, no leading zero10 (March = 3)
DDDD / ddddWeekday name, fullFriday
DDD / dddWeekday name, abbreviatedFri
DD / ddDay of month, 2 digits02
D / dDay of month, no leading zero2
WWISO 8601 week number, 2 digits40
HHHour, 24-hour clock, 2 digits14
HHour, 24-hour clock, no leading zero14
hhHour, 12-hour clock, 2 digits02
hHour, 12-hour clock, no leading zero2
mmMinutes, 2 digits (in a time context)05
ssSeconds, 2 digits09
SSS / fffMilliseconds (fraction of a second, 3 digits)123
A / tt / AAAM/PM designatorPM
aam/pm, lowercase in Moment and Day.js (Java and LDML print PM)pm
ggggEra name (Excel/Word; mainly for the Japanese calendar)AD (Gregorian)

Common date patterns and what they produce

The same handful of tokens combine into the patterns you see on forms, in spreadsheets and in system specifications. The patterns are written in the generic notation used on forms; the right-hand column notes where each one is typically found.

PatternOutputCommonly used for
DDMMYYYY02102026Compact form fields, bank and government forms, reference numbers
DDMMYY021026Short form fields and legacy systems where space is tight
DD/MM/YYYY02/10/2026The everyday numeric format in the UK, Ireland, India, Australia, New Zealand, much of Europe and Latin America
DD-MM-YYYY02-10-2026Netherlands, India and other day-first locales; also common in file names
DD.MM.YYYY02.10.2026Germany, Switzerland, Austria, Russia, Poland, Czechia and other countries that use dots
DD MMM YYYY02 Oct 2026Documents, tickets and reports where the date must be unambiguous across countries
DD MMMM YYYY02 October 2026Formal documents and letters
D MMMM YYYY2 October 2026British and international prose, style guides, legal documents
DD-MON-YYYY02-OCT-2026Oracle Database (TO_CHAR(d, 'DD-MON-YYYY')); Oracle's long-standing default display is the similar DD-MON-RR
DDMMMYYYY02OCT2026SAS DATE9. format (month in capitals); clinical data, airline and banking records
MM/YYYY10/2026Month-level dates: CVs, statements, start and end dates
MM-YYYY10-2026Month-level dates in file names and reports
MM/YY10/26Payment card expiry dates
YYYYMMDD20261002ISO 8601 basic format; file names, database keys, EDI, batch files (sorts correctly as text)
YYYY-MM-DD2026-10-02ISO 8601 extended format; APIs, databases, HTML <input type="date">, and the safest choice for data exchange
YYMMDD261002Machine-readable passport zones (birth and expiry dates), compact log and batch identifiers
DD/MM/YYYY HH:MM02/10/2026 14:05Day-first date with 24-hour time; here the second MM follows HH, so it means minutes
MM/DD/YYYY hh:mm tt10/02/2026 02:05 PMUS date with 12-hour time (.NET notation; written hh:mm aa or hh:mm a in Java-style tools)
YYYYMMDDHHMMSS20261002140509Timestamps in file names, logs and message formats
yyMMddHHmmssfff261002140509123.NET/Java-style compact timestamp with milliseconds, often used in generated IDs

A numeric pattern on its own never tells a reader whether 02/10/2026 is 2 October or 10 February. If you control the format, prefer ISO 8601 (YYYY-MM-DD) for data and a month name (D MMMM YYYY) for people. The DD/MM vs MM/DD guide covers which countries use which order.

The same codes in Excel, strftime, Java, .NET, JavaScript and SQL

The concept is the same everywhere; the letters are not. Each cell below shows the code that produces the value in the first column.

Spreadsheets and programming languages

Concept (example) Excel Word \@ strftime PHP date() Java .NET
4-digit year (2026)yyyyyyyy%YYyyyy / uuuuyyyy
2-digit year (26)yyyy%yyyy / uuyy
2-digit month (10)mmMM%mmMMMM
Month, no zero (3 for March)mM%-mnMM
Abbreviated month (Oct)mmmMMM%bMMMMMMM
Full month (October)mmmmMMMM%BFMMMMMMMM
2-digit day (02)dddd%dddddd
Day, no zero (2)dd%-djdd
Weekday, short (Fri)dddddd%aDEEEddd
Weekday, full (Friday)dddddddd%AlEEEEdddd
Hour, 24-hour (14)hh (no AM/PM in format)HH%HHHHHH
Hour, 12-hour (02)hh + AM/PMhh%Ihhhhh
Minutes (05)mm (after h or before s)mm%Mimmmm
AM/PM (PM)AM/PMAM/PM%pAatt
dd/mm/yyyy patterndd/mm/yyyydd/MM/yyyy%d/%m/%Yd/m/Ydd/MM/yyyydd/MM/yyyy

strftime covers C, Python (datetime.strftime), Ruby (Time#strftime), PHP's deprecated strftime() and the Unix date command. The no-padding flag %-d/%-m is a glibc/BSD extension that Python and Ruby pass through on Linux and macOS; on Windows the C runtime uses %#d instead. Excel codes are shown for English-language Excel; some localised versions use translated letters (German Excel, for example, uses TT.MM.JJJJ). In .NET, a lone d or M is read as a standard format string, so write %d when you need just the day number.

JavaScript libraries and SQL

Concept (example) Moment / Day.js date-fns / Unicode LDML Oracle TO_CHAR MySQL DATE_FORMAT PostgreSQL to_char
4-digit year (2026)YYYYyyyyYYYY%YYYYY
2-digit year (26)YYyyYY / RR%yYY
2-digit month (10)MMMMMM%mMM
Month, no zero (3 for March)MMFMMM%cFMMM
Abbreviated month (Oct)MMMMMMMon (MON → OCT)%bMon (MON → OCT)
Full month (October)MMMMMMMMFMMonth%MFMMonth
2-digit day (02)DDddDD%dDD
Day, no zero (2)DdFMDD%eFMDD
Weekday, short (Fri)dddEEEDy%aDy
Weekday, full (Friday)ddddEEEEFMDay%WFMDay
Hour, 24-hour (14)HHHHHH24%HHH24
Hour, 12-hour (02)hhhhHH12 / HH%h / %IHH12 / HH
Minutes (05)mmmmMI%iMI
AM/PM (PM)A (a → pm)aAM / PM%pAM / PM
dd/mm/yyyy patternDD/MM/YYYYdd/MM/yyyyDD/MM/YYYY%d/%m/%YDD/MM/YYYY

In Oracle and PostgreSQL, Month and Day are blank-padded to a fixed width (for example October  ); the FM prefix removes the padding and leading zeros. Their case follows the code: MON gives OCT, Mon gives Oct. In MySQL, %M is the month name and %i is minutes, the opposite of what strftime users expect. In date-fns, DD and YYYY are day-of-year and week-numbering year, and are rejected unless you opt in, which is why its patterns use dd and yyyy.

Word field codes

In Microsoft Word, a date field's format comes from the \@ date-time picture switch. Press Alt+F9 to show field codes, edit the picture, then press F9 to update:

{ DATE \@ "dd/MM/yyyy" }          → 02/10/2026
{ DATE \@ "dd.MM.yyyy" }          → 02.10.2026
{ DATE \@ "d MMMM yyyy" }         → 2 October 2026
{ TIME \@ "HH:mm" }               → 14:05
{ CREATEDATE \@ "dddd, d MMMM yyyy h:mm am/pm" }

Word uses uppercase M for month and lowercase m for minutes, so \@ "dd/mm/yyyy" puts the minutes where the month should be. You can paste a whole field code into the pattern tester; it extracts the picture from \@ "…" automatically.

Specific patterns explained

What does DDMMYYYY mean?

Two-digit day, two-digit month, four-digit year, with no separators. Each letter stands for one digit, so the result is always eight characters long. Forms that ask for DDMMYYYY usually want only digits; the separated versions are DD/MM/YYYY, DD-MM-YYYY and DD.MM.YYYY.

0210202602/10/2026

DDMMYY vs DDMMYYYY

The only difference is the year: YY keeps the last two digits, YYYY keeps all four. Two-digit years force the reading system to guess the century, and different parsers use different cutoffs, so use DDMMYYYY whenever the field allows it. See date parsing pitfalls.

02102602102026

DD MMM YYYY vs DD MMMM YYYY

Three Ms give an abbreviated month name; four give the full name. Both are unambiguous to a human reader regardless of country, which is why they are used on tickets, contracts and international documents. Month names are language-dependent: MMM is Okt in German.

02 Oct 202602 October 2026

What does DD-MON-YYYY mean?

MON is Oracle's code for the abbreviated month name, printed in upper case when the code is upper case. DD-MON-YYYY is therefore the generic name for dates such as 02-OCT-2026. The closely related DDMMMYYYY (no hyphens) is the SAS DATE9. format, and "ddmmmyyyy" means the same thing.

02-OCT-202602OCT2026

MM vs mm: month or minutes?

In Java, .NET, LDML, date-fns, Moment and Word, MM is month and mm is minutes. Excel uses mm for both and decides by position: right after h/hh or right before ss it means minutes. On paper forms, DD/MM/YYYY HH:MM is understood by context. Writing dd/mm/yyyy in Java prints minutes in the middle.

dd/MM/yyyy HH:mm

YYYY vs yyyy: the week-year pitfall

In Java's DateTimeFormatter, Unicode LDML and date-fns, YYYY is the week-based year from the ISO 8601 week calendar (or the locale's week rules). It matches the calendar year most of the time, but not for a few days around New Year: 29 December 2025 falls in ISO week 1 of 2026, so YYYY prints 2026. Use yyyy (or uuuu) unless you also print the week number.

yyyy-MM-ddYYYY-'W'ww

Frequently asked questions

Short answers to the date pattern questions people search for most.

What does DDMMYYYY mean?

DDMMYYYY is a date pattern meaning a 2-digit day, a 2-digit month and a 4-digit year written together with no separators. 2 October 2026 is written 02102026. With separators it becomes DD/MM/YYYY (02/10/2026), DD-MM-YYYY or DD.MM.YYYY.

What is the difference between DDMMYYYY and DDMMMYYYY?

DDMMYYYY uses a 2-digit month number (02102026), while DDMMMYYYY uses a 3-letter month abbreviation (02OCT2026). The extra M switches the month from a number to a name. DDMMMYYYY is the output of the SAS DATE9. format and is common in clinical, airline and banking records because it cannot be confused between day-first and month-first readings.

What is the format DD MMM YYYY?

DD MMM YYYY is a 2-digit day, a 3-letter month abbreviation and a 4-digit year separated by spaces, for example 02 Oct 2026. DD MMMM YYYY uses the full month name instead: 02 October 2026. D MMMM YYYY drops the leading zero from the day: 2 October 2026.

Is MM month or minutes?

It depends on the system. In Java, .NET, Unicode LDML, date-fns, Moment and Word field codes, uppercase MM is month and lowercase mm is minutes. Excel uses m and mm for both and decides by position: immediately after an hour code or immediately before a seconds code it means minutes, otherwise month. In strftime, %m is month and %M is minutes; in MySQL, %i is minutes and %M is the month name.

What does hh:mm tt mean?

hh:mm tt is a .NET custom format: hh is the hour on a 12-hour clock with a leading zero, mm is minutes and tt is the AM/PM designator. 14:05 is shown as 02:05 PM. Java, LDML and date-fns write the same thing as hh:mm a, and Moment and Day.js as hh:mm A.

What does %d/%m/%Y mean?

%d/%m/%Y is a strftime pattern used by C, Python, Ruby and many other tools. %d is the 2-digit day, %m the 2-digit month and %Y the 4-digit year, so it produces 02/10/2026 for 2 October 2026. %y gives a 2-digit year, so %d-%m-%y produces 02-10-26.

What does gggg mean in a date format?

In Excel and Word date formats, the g codes (g, gg, ggg, and the gggg seen in many templates) display the era name. They are mainly used with the Japanese calendar, where the year is counted within an imperial era such as Reiwa. In .NET custom format strings, g or gg shows the period or era, for example A.D. for the Gregorian calendar.

How do I format a date as dd/MM/yyyy in a Word field code?

Add a date-time picture switch to the field, for example { DATE \@ "dd/MM/yyyy" } or { DATE \@ "dd.MM.yyyy" }. In Word field codes, uppercase M is month and lowercase m is minutes, so dd/mm/yyyy would insert minutes in the middle position. Press Alt+F9 to toggle field codes and F9 to update the field.

Related reading