0

I'm trying to change my Jelastic server environment clock to UTC.

I tried:

hwclock --systohc

But my server (CentOS) somehow does not recognize the command hwclock. Perhaps they removed it, I don't know. I tried searching their docs but did not find how to change the server clock.

Any ideas?

Damien - Layershift
  • 1,508
  • 8
  • 15
MagisterMundus
  • 335
  • 4
  • 18

2 Answers2

2

In general you are expected to manipulate the timezone at application level, not server level (e.g. set the timezone to your needs in php.ini).

If you need the timezone to be changed at server level (e.g. to make cron more understandable), you can contact your hosting provider's support team for this.

The clock itself should already be correctly synchronised with NTP at platform level, so this should only ever be about switching between timezones...

Damien - Layershift
  • 1,508
  • 8
  • 15
  • I understand. The thing is, I am running a NodeJS server and sometimes I create some log files to log internal activity. The files are named according to current date in UTC... The thing is: sometimes the files are created with correct UTC datetime string and sometimes they are created with, let's say, 3 hours less `(ex: file name is '2015-01-01 00:00:00.log' and it's actually 2015-01-01 03:00:00 UTC time at the moment of the file creation)`.. So, basically, I believe it's the server's fault and not my code, which was tested several times and is pretty simple. – MagisterMundus Mar 16 '15 at 16:56
  • I think impossible to review this on here. You should contact your hosting provider for assistance. They can access your server directly, and you can give them specific examples to help their investigation. – Damien - Layershift Mar 17 '15 at 18:01
  • @MagisterMundus To change a timezone for native containers without root access you can use "TimeZone change" add-on which is available in Marketplace. If this add-on is not provided by your hosting provider, you can ask to add it. – Virtuozzo May 26 '17 at 09:03
1

This command should work for VPS and Docker containers by default

ln -sf /usr/share/zoneinfo/Europe/Gibraltar /etc/localtime

For other container templates ask your cloud hosting provider to give you root access.

Ruslan
  • 395
  • 3
  • 12