Setting the correct timezone on a Ubuntu 12.04 Server

Ok, its no rocket science but I thought I’d quickly post up this very easy way to very quickly set your server’s time-zone without the need for editing files and looking up time-zone abbreviations manually etc.  if during installation you accidentally choose the wrong time-zone or (in like my case) your VPS provided has installed a default OS image with a different time-zone.

You can check the current date and timestamp on your server by running the following command at your terminal prompt:-

$ date

This should output something like the following:

Thu Jun 27 09:56:49 BST 2013

So now, you can easily change this by using dpkg-reconfigure and then easily select a new time-zone for your server.

sudo dpkg-reconfigure tzdata

If you are running PHP you will find that you will need to restart the Apache service (if running PHP as an Apache module or if you are using PHP-FRM just restart that service!) the new timestamps will then take effect 🙂

Its also good to know that you should also restart the cron service too if you want the changes to take effect:

$ /etc/init.d/cron stop
$ /etc/init.d/cron start

By far the simplest thing to do at this point is to restart your server entirely (just to make sure that all services are using the new time-zone etc. – but its up to you!!)