Tuesday, May 29, 2012

Different Date Format show command on Linux

Display the date in mm-dd-yy format
$date +"%m-%d-%y"

Output:
02-29-12

Dispaly the date in mm-dd-yyyy format
$date +"%m-%d-%Y"

Output:
02-29-2012

display date as mm/dd/yy format:
$date +"%D"

Output:
02/29/12

OR

display date as mm/dd/yyyy format:
$date +"%m/%d/%Y"

Output:
02/29/2012

No comments: