Converting the MySQL Time Zone
Learn how to convert the time zone in MySQL using the CONVERT_TZ function.
Using the CONVERT_TZ Function
By default, hosting.com servers use the following time zones:
-
US-based (Michigan) servers: US Eastern Time zone
-
Europe-based (Amsterdam) servers: Central European Time zone
-
Asia-based (Singapore) servers: Singapore Standard Time zone
On shared servers, you cannot change the default MySQL time zone, because it affects other accounts on the server. However, you can convert the time zone for DATE, TIME, and DATETIME fields by using the CONVERT_TZ function.
Example: Convert the current date and time in the US Eastern time zone to Paris, France:
SELECT CONVERT_TZ(NOW(), 'US/Eastern', 'Europe/Paris');
Tip
For a complete list of time zones, visit List of TZ database time zones.
More Information
-
For time zone support in MySQL, visit MySQL Time Zone Support.
-
For details on the
CONVERT_TZfunction, visit CONVERT_TZ Function.