Wednesday, January 15, 2014

How to change date and time in Linux

How to change date and time in Linux

It's easy to change Time and Date in Linux, You can use Gui for that, but some Desktop environments do not have a Gui to change time and date, and Servers have no Gui at all.

So we need a command line for that :D
Remember : It's easier with The command Line :)

1- To change Date and Time :


First we have to use root privileges.

and one command such as this :

To change Date and Time in Linux

Or that one :

To change Date and Time in Linux

Oct stands for October.
2006 = a year.
18:00:00 = 18 hours
                   00 Minutes
                   00 Seconds

To make it short and very easy we can use this command :

To change Date and Time in Linux

%Y stands for the year.
%m stands for the month.
%d stands for the day.

So we will put the year first : 2008.
and month : 11.
and day : 28.

Example : 

We would like to change our date  to 2014, month May, and day 2.

date +%Y%m%d -s 20140502

2 - To change Time only :


Type this command with your modification of the time :

To change Time in Linux

10 : Hours.
13 : Minutes.
13 : Seconds.

Note : # sign is not part of the commands, It indicates only that we are signed to terminal as root.

     

Share this article :

0 comments:

Post a Comment