[sr-dev] Safe to change expires column in location table to type timestamp?

Alistair Cunningham acunningham at integrics.com
Mon Nov 4 21:51:51 CET 2013


On 04/11/13 17:25, Daniel-Constantin Mierla wrote:
> Do you know if mysql accepts to set a timestamp column with a datetime
> value? I will look over the code to see if there are potential side
> effects and eventually some workarounds.

Correct me if I'm wrong, but the SQL format of a datetime value is the 
same as a timestamp value. Both are YYYY-MM-DD HH:MM:SS. Therefore in 
the following it doesn't matter whether the '2013-11-04 12:34:56' is a 
datetime or a timestamp:

mysql> create table test ( a datetime, b timestamp );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test values ( '2013-11-04 12:34:56', '2013-11-04 
12:34:56' );
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+---------------------+---------------------+
| a                   | b                   |
+---------------------+---------------------+
| 2013-11-04 12:34:56 | 2013-11-04 12:34:56 |
+---------------------+---------------------+
1 row in set (0.00 sec)

-- 
Alistair Cunningham
+1 888 468 3111
+44 20 799 39 799
http://integrics.com/



More information about the sr-dev mailing list