How to set date from linux shell

For instance, to set the date/time for May 19th, 2007, 6:00pm (and 0 seconds), you would type:

[root@srv ~]# date 051918002007.00

05 - March [Month]
19 - [Date]
1800 - [Time] 6.00 PM
2007 - [Year]
.00 - [Seconds]

OR use following syntax which is very easy and I always prefer it Smile

[root@srv ~]# date -s "31 JULY 1998 23:16:00'"

this will set date and time as July 31, 11:16pm , 1998

Please read man page of date for more info.

Enjoy:)

    0 comments: