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

這篇文章有幫助嗎? 0 用戶發現這個有用 (0 投票)

Powered by WHMCompleteSolution