Fun with the “date” terminal command in macOS

This isn’t a comprehensive list of everything you can do with the date command in macOS, but it’s just a few examples of fun things you can do with date in the Terminal.

To get full date options, you can always run man date:

If you run date by itself, you’ll see the date displayed in a human-readable form:

date
Tue Mar 3 19:48:11 PST 2026

You can also display the date as a UNIX timestamp (number of seconds since January 1, 1970):

date +%s
1772596175

You can convert UNIX timestamps back to human-readable:

date -r 1772596175
Tue Mar 3 19:49:35 PST 2026

And you can convert the human-readable date back to UNIX timestamp:

date -jf '%a %b %e %H:%M:%S %Z %Y' 'Tue Mar 3 19:49:35 PST 2026' +%s
1772596175

Want three days ago instead of today? You can add in the -v flag:

date -v-3d
Sat Feb 28 19:53:19 PST 2026

or

date -v-3d +%s
1772337204

And, of course, you can change minus to plus to get two days from now:

date -v+2d
Thu Mar 5 19:54:45 PST 2026

or

date -v+2d +%s
1772769288


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *