Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After reviewing the MySQL documentation, it appears that if your <code>timestamp</code> value is incorrectly formatted, it would normally cause the timestamp to be <code>'0000-00-00 00:00:00'</code>. In any case, you don't need to specify a timestamp value&mdash;that's the benefit of <code>TIMESTAMP</code> over <code>DATETIME</code>. And even if you did, you can simply set it to <code>NOW()</code> instead of running an unnecessary <code>SELECT</code> statement.</p> <p>Edit:</p> <p>Also, I know you said you thought this through, but have you considered daylight savings time? This could cause two records to have the same timestamp when the clock is set back during autumn.</p> <p>Edit 2:</p> <p>K, I don't know why I didn't catch this earlier, but that timestamp format you gave is incorrect. Try inserting a valid timestamp like <code>'2010/06/19 4:56:17'</code>. MySQL has pretty relaxed parsing of date &amp; time values, but it always has to be year-month-date and hour-minute-seconds.</p> <p>Edit 3:</p> <p>Alright, there seems to be a little confusion over this, so I'm gonna post this quote from the MySQL 5.0 doc page on the <a href="http://dev.mysql.com/doc/refman/5.0/en/datetime.html" rel="nofollow noreferrer"><code>DATETIME</code> format</a>:</p> <blockquote> <p>For values specified as strings that include date part delimiters, it is not necessary to specify two digits for month or day values that are less than 10. '1979-6-9' is the same as '1979-06-09'. Similarly, for values specified as strings that include time part delimiters, it is not necessary to specify two digits for hour, minute, or second values that are less than 10. '1979-10-30 1:2:3' is the same as '1979-10-30 01:02:03'. </p> </blockquote>
 

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