- Code: Select all
mysql_tzinfo_to_sql tz_file tz_name | mysql -u root mysql
- Code: Select all
select CONVERT_TZ(mydate,'GMT','Australia/Melbourne') from mytable;
Thanks
mysql_tzinfo_to_sql tz_file tz_name | mysql -u root mysqlselect CONVERT_TZ(mydate,'GMT','Australia/Melbourne') from mytable;mysql> SELECT CONVERT_TZ('2012-01-01 12:00:00','GMT','Australia/Melbourne');
+---------------------------------------------------------------+
| CONVERT_TZ('2012-01-01 12:00:00','GMT','Australia/Melbourne') |
+---------------------------------------------------------------+
| NULL |
+---------------------------------------------------------------+
1 row in set (0.00 sec)CONVERT_TZ() converts a datetime value dt from the time zone given by from_tz to the time zone given by to_tz and returns the resulting value. Time zones are specified as described in Section 10.6, “MySQL Server Time Zone Support”. This function returns NULL if the arguments are invalid.
mysql> SELECT CONVERT_TZ('2012-01-01 12:00:00','Europe/London','Australia/Melbourne');
+-------------------------------------------------------------------------+
| CONVERT_TZ('2012-01-01 12:00:00','Europe/London','Australia/Melbourne') |
+-------------------------------------------------------------------------+
| 2012-01-01 23:00:00 |
+-------------------------------------------------------------------------+
1 row in set (0.00 sec)Return to Web Server & Applications (Apache + PHP + MySQL / SQLite)
Users browsing this forum: Fibre and 3 guests