Home -- Tutorials -- Quickies -- Manual Pages -- Search -- Feedback -- About The Site -- Forum
Macros/outputs for 'date' command
added 4.11.2005 -- no source information provided


This may seem trivial, but I can never find a quick reference to some of the useful 'date' command macros. I've listed them below for convenience.

You can just append these to the 'date' command to get the output for that macro. For example, 'date +%A' will give 'Monday', or 'Tuesday', etc...

+%A - day of week (Monday, Tuesday, etc...)
+%B - month (January, February, etc...)
+%D - current date in 04/11/2005 format
+%F - current date in 2005-04-11 format
+%G - current year (2005, etc...)
+%R - the time, like 23:41
+%T - the time, like 23:41:27
+%X - the time, like 23:41:27 (again)
+%Y - current year (again)
+%Z - the current time zone (EDT, etc...)

These are just a few, but useful ones that I've needed or wanted to use and have looked for in the past.
© Copyright 1998-2008 VANGEYN.Net, unless otherwise noted.