I recently moved some of my hosted servers to Digital Ocean for their low cost, SSD tiers. On doing so I noticed the time was out by few ours only to realise NTP was not installed and also the time was set to EST. This lead me to check the other settings around locale and discovered the Ubuntu image on Digital Ocean (and possibly others) default to US on EST.
Date and time are one of the easiest things to check:
This will out the full date and time including timezone as any user.
To perform an adhoc / one off time sync the command is
sudo ntpdate [server]
sudo ntpdate pool.ntp.org
To find out the current timezone:
To change the timezone either replace the entry in /etc/timezone with the correct one e.g:
sudo echo "Europe/London" > /etc/timezone
or using a wizard:
sudo dpkg-reconfigure tzdata
sudo apt-get install ntp
By default it uses Ubuntu’s time servers. If you want to change it edit /etc/ntp.conf and replace the section:
Restart NTP service for the changes to take effect:
sudo service ntp restart
Locale is set on a per user, per session basis. This means unless the user has overriden the default in their .bashrc file then they will be using the system default. The default Locale is set in /etc/default/locale and if changed it’s a matter to disconnecting and reconnecting to pick up the new locale.
The default for UK should be set to:
Run the generate command to regenerate the locale settings:
Trival things but sometimes make a big difference. The Locale can affect date formatting to character sets used in files. For example a server used as source control to keeping times in check automatically.