Syntax:

DATETIME [(microsecond precision)]

Microsecond precision can be from 0-6; If not specified 0 is used. Microseconds is available since MariaDB 5.3.

Description:

A date and time combination. The supported range is '1000-01-01 00:00:00.000000' to '9999-12-31 23:59:59.999999'. MySQL displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format, but allows assignment of values to DATETIME columns using either strings or numbers.

Examples:

MariaDB [test]> CREATE TABLE t1 (d DATETIME);
Query OK, 0 rows affected (0.33 sec)

MariaDB [test]> INSERT INTO t1 VALUES ("2011-03-11"), ("2011-03-11 13:08:22");
Query OK, 2 rows affected (0.83 sec)
Records: 2  Duplicates: 0  Warnings: 0

MariaDB [test]> select * from t1;
+---------------------+
| d                   |
+---------------------+
| 2011-03-11 00:00:00 |
| 2011-03-11 13:08:22 |
+---------------------+
2 rows in set (0.00 sec)

MariaDB [test]>

Comments

Comments loading...