Reputation: 5416
This page explains how to format milliseconds http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_now
but how do I get the actual millisecond value beyond just .00000?
I've tried these:
select unix_timestamp()+0;
select SYSDATE()+0;
select date_format(now(), '%f');
select now()+0;
but none of theme give me precise and accurate milliseconds
Upvotes: 4
Views: 11394
Reputation: 435
If you want to get the microsecond from a field, use %f,
select FROM_UNIXTIME(DATE_COLUMN/1000,'%Y-%M-%d %H:%i:%s %f') from TABLE_NAME;
+-------------------------------------------------------+
| FROM_UNIXTIME(CREATETIME/1000,'%Y-%M-%d %H:%i:%s %f') |
+-------------------------------------------------------+
| 2016-March-18 16:02:54 342000 |
+-------------------------------------------------------+
Source : MYSQL DATE_FORMAT
Upvotes: 1