Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li><p>TIMESTAMP is stored in a MySQL proprietary method (though it's basically just a string consisting of year, month, day, hour, minutes and seconds) and additionally, a field of type TIMESTAMP is automatically updated whenever the record is inserted or changed and no explicit field value is given:</p> <pre><code>mysql&gt; create table timestamp_test( id integer not null auto_increment primary key, val varchar(100) not null default '', ts timestamp not null); Query OK, 0 rows affected (0.00 sec) mysql&gt; insert into timestamp_test (val) values ('foobar'); Query OK, 1 row affected (0.00 sec) mysql&gt; select * from timestamp_test; +----+--------+----------------+ | id | val | ts | +----+--------+----------------+ | 1 | foobar | 20090122174108 | +----+--------+----------------+ 1 row in set (0.00 sec) mysql&gt; update timestamp_test set val = 'foo bar' where id = 1; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql&gt; select * from timestamp_test; +----+---------+----------------+ | id | val | ts | +----+---------+----------------+ | 1 | foo bar | 20090122174123 | +----+---------+----------------+ 1 row in set (0.00 sec) mysql&gt; </code></pre></li> <li><p>DATETIME is the standard data type for dates and times which works in conjunction with the date and time functions in MySQL. I'd probably use this in practice</p></li> <li>Storing dates in INTEGER format is not recommended, as you are opening a real can of worms due to interesting problems like time zones, leap years and the like - at least if you intend to query the database based on specific dates stored in that field.</li> </ul>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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