Convert timestamp to tick - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Convert timestamp to tick (/showthread.php?tid=70200) |
RE: Convert timestamp to tick - InsiteFX - 03-13-2018 Did some more research on this on MySQL web site, it seems that you need to create the TIMESTAMP field like below to add the milliseconds to it. PHP Code: CREATE TABLE t1 ( And then to get it back use a select like below. PHP Code: mysql> SELECT UNIX_TIMESTAMP('2015-11-13 10:20:19.012'); Hope that helps anyone for adding milliseconds to a TIMESTAMP OK, Did a MySQL table test using TIMESTAMP and DATETIME column fields. And it does add the milliseconds to the fields. Database code below. PHP Code: -- -------------------------------------------------------- If you notice you need to specify the milliseconds field length in the fields even NOW(6). Here is a method to strip out the un-wanted characters: PHP Code: /** To Store in MySQL you would need to use a BIGINT(20) field value. |