19 Sept 2012

Different date formats in Unix


Date Format: 

1 > $a=`date '+%d%m%y_%H%M%S'`
$echo $a
130812_195306

2 >$a=`date '+%d%m%Y_%H%M%S'`
$echo $a
13082012_195409

3 >$a `date '+%d-%m-%Y %H:%M:%S'`
$echo $a
13-08-2012 19:57:13
-->

2 comments:

  1. Please let me know the command for getting 12 hr format time.

    Thanks

    ReplyDelete
  2. Hi,

    date +%T --> This will give 24hrs format
    date +%R --> This will give 12hrs format

    More Please refer http://bsolutionsforu.blogspot.in/2012/09/unix-basic-date-commands.html

    ReplyDelete