Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Assuming you are using 5.5, if you see <a href="http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html</a>, it says:</p> <p><code>mysql&gt; SET time_zone = timezone;</code></p> <p>It also says:</p> <pre><code>The current session time zone setting affects display and storage of time values that are zone-sensitive. This includes the values displayed by functions such as NOW() or CURTIME(), and values stored in and retrieved from TIMESTAMP columns. Values for TIMESTAMP columns are converted from the current time zone to UTC for storage, and from UTC to the current time zone for retrieval. The current time zone setting does not affect values displayed by functions such as UTC_TIMESTAMP() or values in DATE, TIME, or DATETIME columns. Nor are values in those data types stored in UTC; the time zone applies for them only when converting from TIMESTAMP values. If you want locale-specific arithmetic for DATE, TIME, or DATETIME values, convert them to UTC, perform the arithmetic, and then convert back. </code></pre> <p>So try it without the <code>SESSION</code> and see if it works, and also check that <code>select @@session.time_zone; </code> gives you the right timezone.</p> <p>EDIT: you may just have an issue with your database. I just tried this on one of my databases (5.5.8) and it worked, but it failed on 5.0.51. So you may need a db upgrade.</p> <pre><code>mysql&gt; select CURRENT_TIMESTAMP(); +---------------------+ | CURRENT_TIMESTAMP() | +---------------------+ | 2011-05-29 14:33:06 | +---------------------+ 1 row in set (0.00 sec) mysql&gt; set time_zone = 'Europe/Rome'; Query OK, 0 rows affected (0.00 sec) mysql&gt; select CURRENT_TIMESTAMP(); +---------------------+ | CURRENT_TIMESTAMP() | +---------------------+ | 2011-05-29 16:33:11 | +---------------------+ 1 row in set (0.00 sec) mysql&gt; select version(); +-----------+ | version() | +-----------+ | 5.5.8-log | +-----------+ 1 row in set (0.00 sec) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload