How to Print the Current Date in Your Own Format with date in the Terminal
date prints the current date and time, and a format that starts with + makes it print them your way: 2026-12-03, 16:05:32, or Thu, 03 Dec 2026 16:05:30 GMT, the date format HTTP prefers. Each % code in the format stands for one part of the date.
This guide builds four formats, with real output from zsh 5.9 and bash 3.2 on macOS. Every command uses -u, so the time is in UTC and the same wherever you run it.
Syntax
date -u '+<format>'
| Part | What it means |
|---|---|
-u | Use UTC instead of your computer's time zone |
+ | Says that what follows is a format |
<format> | Text with % codes in it. Each code becomes one part of the date, and everything else is printed as it is |
'...' | Single quotes keep the whole format together as one piece, spaces included |
The macOS manual page, man date, describes the +: An operand with a leading plus (‘+’) sign signals a user-defined format string which specifies the format in which to display the date and time. The codes are listed in man strftime. These are the ones this guide uses:
| Code | Replaced by | Example |
|---|---|---|
%a | The weekday, short | Thu |
%A | The weekday, in full | Thursday |
%d | The day of the month, 01 to 31 | 03 |
%b | The month, short | Dec |
%B | The month, in full | December |
%m | The month as a number, 01 to 12 | 12 |
%Y | The year with the century | 2026 |
%H | The hour on a 24-hour clock, 00 to 23 | 16 |
%M | The minute, 00 to 59 | 05 |
%S | The second, 00 to 60 | 30 |
The Example
You print the date and time in UTC five ways: in date's own format, as an HTTP date, as a date, as a time, and inside a sentence.
Step 1: Print the Date in UTC
date -u
Thu Dec 3 16:05:29 UTC 2026
That's date's own format. The manual describes -u as Display or set the date in UTC (Coordinated Universal) time. and says what happens without it: By default date displays the time in the time zone described by /etc/localtime or the TZ environment variable.
Step 2: Print It in Your Own Format
date -u '+%a, %d %b %Y %H:%M:%S GMT'

Thu, 03 Dec 2026 16:05:30 GMT
date replaced each code with its part of the date and copied the rest, the comma, the spaces, the colons and the word GMT, exactly as written. The result has the same shape as the example in RFC 9110, the HTTP standard: Sun, 06 Nov 1994 08:49:37 GMT is An example of the preferred format. The standard also says An HTTP-date value represents time as an instance of Coordinated Universal Time (UTC). That's why the command needs -u: the GMT at the end is only true for a time in UTC.
Step 3: Try Other Formats
A date, a time, and a sentence with the full names:
date -u '+%Y-%m-%d'
date -u '+%H:%M:%S'
date -u '+Today is %A, %d %B %Y.'
2026-12-03
16:05:32
Today is Thursday, 03 December 2026.

In the sentence, everything that isn't a code, Today is and the final full stop included, came out as typed. bash printed the same formats, with its own seconds.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
No +: date -u '%Y-%m-%d' | date: illegal time format, then the command's usage, and exit status 1 | Start the format with + |
No quotes around a format with spaces: date -u +%a, %d %b %Y | The same date: illegal time format | Put the whole format in single quotes |
%m for the minutes: date -u '+%H:%m' | It printed 16:12, the hour and the month, while '+%H:%M' printed 16:05 | %M is the minute, %m is the month |
The first two have the same cause. The manual: If an operand does not have a leading plus sign, it is interpreted as a value for setting the system's notion of the current date and time. Without quotes, the spaces split the format into four pieces, and %d, %b and %Y don't start with a plus. Neither piece of text is a time date can read, and both runs ended with exit status 1. The manual: The date utility exits 0 on success, 1 if unable to set the date, and 2 if able to set the local date, but unable to set it globally.
FAQ
Is there a ready-made format for this?
Close to it. date -u -R printed Thu, 03 Dec 2026 16:05:50 +0000. The manual: Use RFC 2822 date and time output format. It ends in +0000, not GMT, so for the format in Step 2, write it out yourself.
Why did %y print 26?
Lowercase %y is the year without the century. man strftime: is replaced by the year without century as a decimal number (00-99). Use %Y for 2026.
Will the day and month names always be in English?
No. man strftime says %a is replaced by national representation of the abbreviated weekday name, so the names follow the language settings. With LC_ALL=de_DE.UTF-8 in front, German, date -u '+%a, %d %b' printed Do., 03 Dez.. With LC_ALL=C in front, it printed Thu, 03 Dec.
Conclusion
date -u '+%a, %d %b %Y %H:%M:%S GMT' printed Thu, 03 Dec 2026 16:05:30 GMT, and '+%Y-%m-%d' printed 2026-12-03. Start every format with +, keep it in single quotes, and tell %m, the month, from %M, the minute.
Additional Resources
man dateandman strftimein your terminal: the macOS manual pages fordateand for every%code.- RFC 9110, section 5.6.7: Date/Time Formats: the date format HTTP uses.
