Thursday 16 August 2012

Set the Time and Date in Linux

Set the Time and Date in Linux

if you change the date and time must be log in to the "root" user.

To change the date and time.


[root@srvr77 ~]# date -s '16 Aug 2012 18:48:30'
Thu Aug 16 18:48:30 IST 2012
or 

[root@srvr77 ~]# date --set="16 Aug 2012 18:43:00"
Thu Aug 16 18:43:00 IST 2012



To check the date and time

[root@srvr77 ~]# date
Thu Aug 16 18:43:06 IST 2012



To set only the Time

[root@srvr77 ~]# date +%T -s '02:02:02'
02:02:02


[root@srvr77 ~]# date +%T%p -s '02:02:02am'
02:02:02AM

[root@srvr77 ~]# date +T%p  -s '19:00:00PM'
19:00:00PM