This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

DATETIME

Sintassi

DATETIME [(precisione in microsecondi)]

La precisione in microsecondi può essere da 0 a 6; se non è specificata, sarà 0. I microsecondi sono supportati a partire da MariaDB 5.3.

Spiegazione

Una combinazione di data e ora. I valori supportati vanno da '1000-01-01 00:00:00.000000' a '9999-12-31 23:59:59.999999'. MariaDB mostra i valori DATETIME nel formato 'YYYY-MM-DD HH:MM:SS', ma permette di assegnarli alle colonne DATETIME sia come numeri sia come stringhe.

Esempi

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]> 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.