MySQL select formatted date from millisecond field
Try using the FROM_UNIXTIME
function like this as given in the manual
SELECT FROM_UNIXTIME(1196440219); -> '2007-11-30 10:30:19'
You could also use formatting like this
mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(), -> '%Y %D %M %h:%i:%s %x'); -> '2007 30th November 10:30:59 2007'
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