Unix Date Format Specifiers

I could just remember to search wikipedia for "Date (Unix)" or search my site for "Unix". This was easier.

Source: Wikipedia: Date (Unix)

Format specifiers (format string starts with +)
Specifier Description Values/Example
%a weekday, abbreviated Mon
%A weekday, full Monday
%d day of the month (dd), zero padded 04
%e day of the month (dd) 4
%j day of year, zero padded 001-366
%u day of week starting with Monday (1), i.e. mtwtfss 1
%w day of week starting with Sunday (0), i.e. smtwtfs 1
%U week number Sunday as first day of week 01–53
%W week number Monday as first day of week 01–53
%V week of the year 01–53
%m mm month 07
%h Mon Jul
%b Mon, locale's abbreviated Jul
%B locale's full month, variable length July
%y yy two digit year 00–99
%Y ccyy year 2011
%g 2-digit year corresponding to the %V week number
%G 4-digit year corresponding to the %V week number
%C cc century 00–99
%D mm/dd/yy 07/4/11
%x locale's date representation (mm/dd/yy) 07/4/2011
%F %Y-%m-%d 2011-07-4
%l (Lowercase L) hour (12 hour clock) 1
%I (Uppercase I) hour (12 hour clock) zero padded 01
%k hour (24 hour clock) 13
%H hour (24 hour clock) zero padded 13
%p locale's upper case AM or PM (blank in many locales) PM
%P locale's lower case am or pm pm
%M MM minutes 20
%s seconds since 00:00:00 1970-01-01 UTC (Unix epoch) 1309785651
%S SS second 00–60
(The 60 is necessary to accommodate a leap second)
%N nanoseconds 000000000–999999999
%r hours, minutes, seconds (12-hour clock) 01:20:51 PM
%R hours, minutes (24 hour clock) hh:mm e.g. 13:20
%T hours, minutes, seconds (24-hour clock) 13:20:51
%X locale's time representation (%H:%M:%S)
Date and Time
%c locale's date and time Sat Nov 04 12:02:33 EST 1989
Time zone
%z -zzzz RFC-822 style numeric timezone -0500
%Z time zone (e.g., EDT) nothing if no time zone is determinable EST

Credit where Credit is Due:

Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman

Related Articles

Joes Revolver Map


Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Donate to Joel Lipman via PayPal

Donate to Joel Lipman with Bitcoin - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.