How to change the date of Linux to UTC/GMT +1?
The normal way is to set your timezone. There are a bunch of files stored by region in the following directory:
/usr/share/zoneinfo
Take a look and find the one which matches your region. Then you have to create a symlink from /etc/localtime
:
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
You need to change the timezone.
To do it system-wide, symlink
/etc/localtime
to the apropriate file in/usr/share/zoneinfo
. For example:ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
In CentOS, you might need to also edit
/etc/sysconfig/clock
.To change the timezone just for the current user, set $TZ instead:
export TZ="Europe/Paris"
Note that date -u
must always return correct UTC time.