Setting the system date and clock

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » System Level

Setting the system date and clockLast Modified: Jul 9, 2015, 4:48 pm
To set the system clock, use the date command.

For Redhat Systems, use the following format:

date --set="Mmm DD HH:MM:SS YYYY"


date --set="Oct 20 15:52:29 2004"

For FreeBSD systems, use the following format:



date 0410201544

Will set the date/time to 2004, October 20th, 15:44 (3:44pm).

For any operating system, if you have the rdate program, you can simply type:

rdate -s

to sync your server with the atomic clock in Boulder, Colorado.
ntp is a newer, more accurate method of setting the date:

/usr/sbin/ntpdate -b -u

Note that if the value set by rdate/ntpdate isn't correct, then you likely have a wrong timezone specified. Commands like system-config-date or redhat-config-date can set it up for you.  Else you'd need to create a symbolic link from one of the timezones in /usr/shared/zoneinfo to /etc/localtime, eg:

mv /etc/localtime /etc/localtime.moved
ln -s /usr/share/zoneinfo/Canada/Mountain /etc/localtime

You should also update your php.ini to use the correct timezone.
Edit the value:

date.timezone = "UTC"

and change UTC to one of the valid timezone's that php can accept/

2003 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST