shellDifferent Date/Time format in shell


Parameters

FormatInterpreted as
%%literal percent sign (%)
%Aweekday name (e.g. Sunday)
%aweekday name in short fomat (e.g. Sun)
%Bfull month name (e.g. January)
%bmonth name (e.g. Jan)
%Hhour (00..23)
%Ihour (01..12)
%jday of year (001..366)
%khour ( 0..23)
%lhour ( 1..12)
%Mminute (00..59)
%mmonth (01..12)
%pDefine AM or PM; blank if not known
%R24-hour hour and minute; same as %H:%M
%r12-hour clock time (e.g. 11:11:04 PM)
%Ssecond (00..60)
%sUnix epoch: seconds since 1970-01-01 00:00:00 UTC (not available in older UNIXes)
%Ttime, equivalent to %H:%M:%S
%Ztime zone name (e.g. PDT)
%ztime zone offset (direction, hours, minutes, e.g. -0700)

Remarks

Below are a few useful links for the date command in Unix shells: