You can replace the hyphen (-) and colon (:) characters with any other punctuation character without affecting : DateTime « Data Type « SQL / MySQL






You can replace the hyphen (-) and colon (:) characters with any other punctuation character without affecting

     
 validity.
mysql>
mysql> CREATE TABLE tt(ts DATETIME);
mysql>
mysql> INSERT INTO tt(ts) VALUES('1999+11+11 23-24');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> INSERT INTO tt(ts) VALUES('1999+12=12-12-12');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> select * from tt;
+---------------------+
| ts                  |
+---------------------+
| 1999-11-11 23:24:00 |
| 1999-11-11 23:24:00 |
| 1999-11-11 23:24:00 |
| 1999-12-12 12:12:00 |
+---------------------+
4 rows in set (0.00 sec)

mysql>
mysql> drop table tt;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
  








Related examples in the same category

1.DATETIME: Combination of DATE and TIME in the form '2003-12-31 23:59:59' (8 bytes)
2.Datetime as column type
3.Order by DATETIME
4.Produce a time-of-day summary for records