php - Converting date (with milliseconds) into timestamp -


this question has answer here:

i have date format '25 may 2016 10:45:53:567'.

i want convert time stamp.

strtotime function returns empty.

$date = '25 may 2016 10:45:53:567'; echo strtotime($date);  // returns empty 

when removed milliseconds, it's working.

$date = '25 may 2016 10:45:53'; echo strtotime($date); // returns 1464153353 

please sort out issue. in advance.

split string:

$date = '25 may 2016 10:45:53:001'; preg_match('/^(.+):(\d+)$/i', $date, $matches); echo 'timestamp: ' . strtotime($matches[1]) . php_eol; echo 'milliseconds: ' . $matches[2] . php_eol; // timestamp: 1464162353  // milliseconds: 001  

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -