date

From Initq

Jump to: navigation, search

Display the current time in the given FORMAT, or set the system date.

date [OPTION]... [+FORMAT] The + sign is only used for format.

The format is [MMDDhhmm[[CC]YY][.ss]]


Example

date 102020122009

Universal Time

qais@qais:~$ date -u
Tue Nov  3 18:29:05 UTC 2009

AM/PM format

qais@qais:~$ date +%T%p
12:40:26PM
[root@initq test]# date '+%y'
10
[root@initq test]# date '+%Y'
2010
[root@initq test]# date '+%Y%m'
201003
[root@initq test]# date '+%Y%m%d'
20100331
[root@initq test]# date '+%Y%m%d%h'
20100331Mar
[root@initq test]# date '+%Y%m%d%H'
2010033120
[root@initq test]# date '+%Y%m%d%H%d'
201003312031
[root@initq test]# date '+%Y%m%d%H%d%s'
2010033120311270084280
[root@initq test]# date '+%Y%m%d%H%d%S'
20100331203125
Personal tools