Convert timestamp to tick |
03-13-2018, 03:22 AM
(This post was last modified: 03-13-2018, 05:18 AM by InsiteFX. Edit Reason: Added Database code to create table etc; )
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |