How to set or change date and time in Linux

Here I will show you some steps to set or change the date and time of your Linux machine using CLI

To view the currently set date and time on your linux machine# date
To only view the date on your local Linux machine
# date +%D
To only view the time on your local Linux machine
# date +%T
 Now to change the date and time at once
# date –set “18 Aug 2012 12:39:36”
where
18 : date
Aug : Month
2012 : Year
12 : Hour
39 : Minute
36 : Second
Now if you only want to change the date or time
To change date
# date +%D -s “20120818”
To change time
# date +%T -s “12:48:20”
All the above commands can also be practiced using –set parameter
For example”
# date –set “18 Aug 2012 12:39:36”
# date +%D –set “20120818”
# date +%T –set “12:48:20”

Follow the below links for more tutorials

Leave a Comment