Tutorial by Examples

This fetches the value of NOW() in local time, in India Standard Time, and then again in UTC. SELECT NOW(); SET time_zone='Asia/Kolkata'; SELECT NOW(); SET time_zone='UTC'; SELECT NOW();
If you have a stored DATE or DATETIME (in a column somewhere) it was stored with respect to some time zone, but in MySQL the time zone is not stored with the value. So, if you want to convert it to another time zone, you can, but you must know the original time zone. Using CONVERT_TZ() does the con...
This is really easy. All TIMESTAMP values are stored in universal time, and always converted to the present time_zone setting whenever they are rendered. SET SESSION time_zone='America/Los_Angeles'; SELECT timestamp_sold FROM sales WHERE state_sold = 'CA' Why is this? TIMESTAMP values are...
Each server has a default global time_zone setting, configured by the owner of the server machine. You can find out the current time zone setting this way: SELECT @@time_zone Unfortunately, that usually yields the value SYSTEM, meaning the MySQL time is governed by the server OS's time zone sett...
To get a list of possible time_zone values in your MySQL server instance, use this command. SELECT mysql.time_zone_name.name Ordinarily, this shows the ZoneInfo list of time zones maintained by Paul Eggert at the Internet Assigned Numbers Authority. Worldwide there are appproximately 600 time z...

Page 1 of 1