How to use the date format string translator
- Choose the notation you are translating from and the one you are translating to.
- Type or paste date format strings, one per line, written the way they are written in the source notation.
- Read the translated formats. The notes show a sample date for each, and warn where a notation works differently.
- Copy the formats into your code, spreadsheet or configuration.
One format in several notations
The Java format yyyy-MM-dd HH:mm:ss is %Y-%m-%d %H:%M:%S in strftime, YYYY-MM-DD HH:mm:ss in Moment.js, Y-m-d H:i:s in PHP and yyyy-mm-dd hh:mm:ss in Excel. All of them print the sample moment, Saturday, March 7, 2026 at 14:05:09, as 2026-03-07 14:05:09.
The Java format EEEE, MMMM d, yyyy is dddd, MMMM D, YYYY in Moment.js and prints Saturday, March 7, 2026. The Java format dd/MM/yy hh:mm a is d/m/y h:i A in PHP and prints 07/03/26 02:05 PM. The strftime format %d/%m/%Y becomes dd/mm/yyyy in Excel.
Why the same letters mean different things
Notations disagree on basic letters. In Java and .NET, lower case yyyy is the year and dd the day. In Moment.js and Day.js, the year is YYYY and the day DD, and lower case dd is the short weekday. In PHP, Y is the year and m the month, but in Java a small m is the minute and a capital M the month. Excel uses m for both months and minutes, and decides from the neighbors.
Excel reads m or mm as minutes when it comes right after hours or right before seconds, and as months otherwise. The page applies that rule when it reads Excel formats and warns when it writes a month next to hours or seconds. Excel also shows a 12 hour clock whenever AM/PM is in the format.
What cannot be translated
Not every notation has every token. PHP and .NET have no 3 digit day of the year, .NET has no numeric offset without a colon, and Excel has no time zone tokens. When a token has no match, the page says which one, rather than guessing. Tokens that only some systems have, such as the no-padding %-d in strftime, produce a note about where they work. To convert actual dates and times, use the Unix Timestamp Converter, the Excel Date Serial Number Converter, the Date Calculator and the ID Timestamp Decoder.
Assumptions and limits
- The notations covered are strftime (C, Python, Ruby), Java and Unicode patterns, Moment.js and Day.js, .NET custom formats, PHP date() and Excel TEXT().
- The sample moment is Saturday, March 7, 2026, 14:05:09.123 at +05:30, and month and weekday names are in English.
- Up to 200 lines are translated at a time. A line with a token the source notation does not have stops the translation with a message.
- Locale-dependent tokens, such as .NET date separators, follow the locale of the system that uses the format.
Frequently asked questions
What is strftime?
It is the date formatting function of C, which Python, Ruby and many other languages copied. Its formats use a percent sign and a letter, such as %Y for the year and %H for the hour.
Why does Excel show minutes where I wanted months?
Excel treats mm as minutes when it follows an hour or precedes seconds. Put a different separator or other part between them, or use a different layout, to keep it a month.
Why can't every format be translated?
Some notations lack a token that another has, for example the day of the year in PHP or a time zone name in Excel. The page names the token that cannot be translated and does not guess.
How are literal words handled?
Text that is not a token is quoted or escaped the way the target notation requires, with single quotes in Java and .NET, brackets in Moment.js, backslashes in PHP and Excel, and nothing in strftime.