How To Change The Date And Time From The Console

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by estrellagalicia (Contact Author) (Forums) on Mon, 2010-07-19 19:20. :: Linux

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

or

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

or

date --set=hh:mm:ss

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


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by google (not registered) on Tue, 2010-07-27 18:45.

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

http://planet.admon.org/howto/set-timezone-date-and-time-in-linux/

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

Submitted by Kamran Souratgar (not registered) on Sat, 2010-07-24 04:37.

After setting, sink your hardware time with this command:

 # hwclock -w

Submitted by Marc Coxall (not registered) on Tue, 2010-07-20 08:19.

I like to use the natural language method

 date -s "July 20 2010 08:20"

Submitted by Anonymous (not registered) on Tue, 2010-07-20 15:57.

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"

 

Submitted by mike list (not registered) on Tue, 2010-07-20 14:40.

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

 

Submitted by thaygiaoth (not registered) on Thu, 2010-07-22 03:42.

I think setup command is easy to solve this problem

 install: yum install setup

 

 

 

Sponsored Links: Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com

One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com

One number. one voicemail. Seize the lead with Sprint. Learn more

AT&T Synaptic Compute as a Service. Boost your power on demand.

Trial: IBM Cognos Express Reporting, Analysis & Planning

Learn benefits of Simpana software.
View the Gartner Video

Sprint 4G - The Ultimate Mobile Broadband
Click here

SAP-Business Objects Crystal Reports Server
Complete reporting without hidden costs. Free Trial