Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>tl;dr You should be fine as long as your <code>exec_time</code> column has a TIMESTAMP data type.</p> <p>There isn't an explicit UNIX_TIMESTAMP column datatype. There is a TIMESTAMP column data type. Values for columns of this data type are converted automatically from your client connection's time zone to UTC (a/k/a Z or Zulu time, f/k/a Greenwich Mean Time) when being converted from a date/time string and from UTC to your client connection's time zone upon conversion to a date/time string.</p> <p>So, if you're storing your <code>exec_time</code> column as a <code>TIMESTAMP</code>, you should be able to use the clause you propose:</p> <pre><code> WHERE exec_time &lt;= UNIX_TIMESTAMP() </code></pre> <p>This will work because both your <code>exec_time</code> values and the result of the <code>UNIX_TIMESTAMP()</code> function call are handled in UTC on the server side. Your <code>exec_time</code> values will be stored in UTC.</p> <p>If you're storing <code>exec_time</code> as an <code>UNSIGNED INT</code> or a similar numeric data type, you won't have been able to take advantage of the automatic conversion to UTC before storing.</p> <p>You can mess with the display conversion behavior by setting your client connection time_zone as follows:</p> <pre><code> SET time_zone='SYSTEM' /* for your system's local time */ </code></pre> <p>or </p> <pre><code> SET time_zone='+0:00' /* for UTC */ </code></pre> <p>or </p> <pre><code> SET time_zone'America/New_York' /* or 'Europe/Vienna' or whatever */ </code></pre> <p>Once you've issued one of these SET operations, do </p> <pre><code> SELECT exec_time, FROM_UNIXTIME(exec_time) </code></pre> <p>to get a sense of how your values are stored server side and translated.</p> <p>If you want to see what will happen eight days on, try this:</p> <pre><code> SELECT 3600*24*8+exec_time, FROM_UNIXTIME(3600*24*8+exec_time) </code></pre> <p><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></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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