Converting the MySQL time zone
Ce contenu n’est pas encore disponible dans votre langue.
Using the CONVERT_TZ Function
Section titled “Using the CONVERT_TZ Function”Ruachost servers, including MySQL, run on UTC (GMT+0).
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 server time (UTC) to Lagos, Nigeria:
SELECT CONVERT_TZ(NOW(), '+00:00', '+01:00');Using UTC offsets such as +01:00 always works. Named zones such as Africa/Lagos only work if the server has the MySQL time zone tables loaded.
More Information
Section titled “More Information”- For time zone support in MySQL, visit MySQL Time Zone Support.
- For details on the
CONVERT_TZfunction, visit CONVERT_TZ Function. - To make MySQL use your local time for your website, see Setting the MySQL time zone for your website.
Cette page vous a-t-elle aidé ?
Merci pour votre retour.