How To Change The Date And Time From The Console

This short tutorial explains how you can modify your system date and time from the console.

To change the date on Linux from the console type:

date -d mm/dd/yy


date --date=mm/dd/yy

where mm=month, dd=day and yy=year

To change the time on Linux from the console type:

date -s hh:mm:ss


date --set=hh:mm:ss

where hh=hour, mm=minute, ss=second

Share this page:

6 Comment(s)

Add comment


From: Marc Coxall at: 2010-07-20 07:19:19

I like to use the natural language method

 date -s "July 20 2010 08:20"

From: mike list at: 2010-07-20 13:40:37

i prefer to use ntpd which sets your system relative to greenwich mean time.


From: thaygiaoth at: 2010-07-22 02:42:13

I think setup command is easy to solve this problem

 install: yum install setup




From: Anonymous at: 2010-07-20 14:57:26

I use: date -u mmddhhmm (with the aid of an atomic watch), i.e. which sets the UTC time, and local time is resolved by locale (previously setup) as follows:

# setup local timezone
rm /etc/localtime
# setup for EDT and EST (+4 EDT; +5 EST)
ln -s /usr/share/zoneinfo/EST5EDT /etc/localtime
# setup for only EST (+5 EST)
#ln -s /usr/share/zoneinfo/EST /etc/localtime
rm /etc/timezone
echo "US/Eastern" > /etc/timezone
export TZ="/usr/share/zoneinfo/America/New_York"


From: Kamran Souratgar at: 2010-07-24 03:37:39

After setting, sink your hardware time with this command:

 # hwclock -w

From: google at: 2010-07-27 17:45:20

After google around, a more specific version is available here:

It also helps me fix the time issues in a virtualized private server, enjoy :)