Magento and UTC on Hypernode
Table of contents
Getting Magento to work with system timezone set to UTC
As you probably know, the world is divided in a bunch of time zones. Because Hypernode is hosted in the cloud, the system timezone is set to UTC. This is because we cannot always know in what timezone the server will be hosted, but we want to deliver a consistent system timezone for our customers.
You will probably want to work in a different timezone OR show a different timezone to your customers. So this is an issue not only when dealing with a Hypernode, but also when operating an intercontinental shop.
- You should set the global timezone for Magento to the UTC-equivalent GMT Standard Time.
- Then, set the timezone for all websites to your local timezone.
- If you are in The Netherlands, choose “Europe/Berlin” if “Europe/Amsterdam” is not in the list.
So what is the problem?
The timezone nut is actually not that hard to crack. But Magento has some internals that loose the sense of time zones by converting to and from an ancient time format called the Unix Time. This is a time format does not have a sense of time zones.
This problem crops up when calculating stuff involving dates and shows up as weird problems like:
- Catalog price rules will disappear after a few hours.
- Magento cronjobs email you with the error “Too late for schedule”.
All of this is because MySQL and Magento do not agree on the timezone to use and also do not communicate correctly.
To solve this problem, Magento should operate on the same timezone as the server. Then, to display all dates and times on your websites and stores as you like them, set the timezone for all websites to your preferred timezone.
1. Set the global timezone to GMT or UTC
If Magento does not support the UTC timezone, then select its equivalent GMT Standard Time.
- Go to System -> Settings
- Edit your default scope
- Go to Configuration -> General -> General -> Locale Options
- Select GMT Standard Time
Note that this is not UTC, but it is in almost all cases exactly the same as UTC, which is good enough. UTC and GMT both do not follow summer time or winter time. They only differ on leap seconds.
2. Set your default website scopes to your preferred time zones
Next are your website scopes. These will ensure that your websites display Dutch, Chinese or American order and shipping times, or some other time according to your settings.
- Go to System -> Settings
- Select the scope for each of your websites. The example edits Gudz.nl and repeats the process for Judopak and Karatepak.
- Go to Configuration -> General -> General -> Locale Options again.
- Select W. European Standard Time (Europe/Berlin or Europe/Amsterdam) or select some other timezone appropriate for the location of your customers.
- Repeat for the next website.
Please note: Europe/Amsterdam is not available in all Magento version. The timezone Europe/Berlin is equivalent.