Software >> OS >> Unix >> Linux >> Commands >> date >> How to format the output of the date command

 

date +FORMAT   

where FORMAT is a combination of    

%a   locale's abbrev weekday name (Sun, Mon ...)
%A   locale's full weekday name (Sunday, Monday ...)
%u   day of the week (1..7, where 1=Monday)  
%m   2 digit month  
%d   day of the month (01..31)
%e   day of the month, blank padded (1..31)  
%b   locale's abbrev month name (Jan, Feb ...)
%B   locale's full month name (January, February ..)  
%C   locale's century year (divide by 100 and truncate to integer 00-99)
%g   2 digit year
%G   4 digit year   
%I   hour (01..12)      
%H   hour (00..23)  
%M   minute (00..59)  
%s   seconds since epoch  
%S   seconds (0..60)   

etc   

eg. for 01 Jan 2008:-   

date  +%d-%m-%G  

01-01-2008