Cannot millisecond resolution in a DATETIME column using MariaDB 5.5.44
According to all of the documentation I have read, this looks pretty simple to do. But it just does not work. This is the snippet that shows how I defined the column.
<<code>>
id int(12) NOT NULL auto_increment,
ev_time DATETIME(3) NOT NULL,
hostname varchar(65) NOT NULL,
subsys varchar(65),
<<code>>
I have tried using both TIMESTAMP and DATETIME, both give me the same results, the trailing 3 digits are always returned with a value of 000. When I insert, it does not matter if I leave the ev_time field blank and let it autofill, or if I put NOW() in the insert, the result is always this output:
<<code>>
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
2018-07-06 07:58:11.000 |
+-------------------------+
<<code>>
Why doesn't this work???
Answer
You should specify the precision, for example NOW(3).