• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1004
  • Last Modified:

CentOS 5.6 Set Date, Time and Time Zone

How do i set the time zone, time and date in centos?
0
deklinm
Asked:
deklinm
  • 4
  • 2
1 Solution
 
savoneCommented:
Follow this guide to change the tmezone:

http://www.redhat.com/advice/tips/timezone.html

As for setting the time and date use the "date" command.

http://unixhelp.ed.ac.uk/CGI/man-cgi?date

example:
date --set="Wed Dec 7 17:50:05"
0
 
xtermCommented:
If you want to keep your time accurate, use the network time protocol.

  yum install ntp
  ntpdate <ip address of your time server>

Then you can cron it nightly with something like:

  # set clock each day at 2:15AM
  15 2 * * * root /usr/sbin/ntpdate mytimeserver.net 1>/dev/null
0
 
deklinmAuthor Commented:
I cannot get the time zone to update.  It keeps coming up 7 hours off.  How can I fix that?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
xtermCommented:
What specifically are you using to show the time on the machine - the "date" command?
0
 
xtermCommented:
And make sure that /etc/sysconfig/clock looks good, something like this:


ZONE="America/Chicago"
UTC=true
ARC=false

Open in new window

0
 
deklinmAuthor Commented:
My /etc/sysconfig/clock looks like

ZONE="America/New_York"
UTC=true
ARC=false

However the time keeps coming up as Thu Dec  8 18:26:37 UTC 2011......7 hours ahead

0
 
xtermCommented:
That's because its showing the time in UTC (aka GMT)  The time is correct, it's just not showing it with your zone.

You need to do:
cp /usr/share/zoneinfo/America/New_York /etc/localtime

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now