2015-12-11 34 views
-3

我有一個時間字符串2015-12-04 17:02:10 +00:00格式。轉換2015-12-04 17:02:10 +00:00時間到微秒

我想我怎麼能轉換這個在PHP這個字符串轉換在mircoseconds decimal(16,4)1449825379.3464

?我試了一下用:

echo strtotime("2015-12-04 17:02:10 +00:00"); 

,但它只是返回1449248530沒有微秒。

+2

你嘗試過什麼嗎? – swidmann

+0

** [注意:堆棧溢出不是教練中心。] ** –

+0

我試過echo strtotime(「2015-12-04 17:02:10 +00:00」);並返回1449248530 – Vijay

回答

0

你可以這樣做,但你應該在你的日期字符串中提供毫秒。

<?php 
$date = new DateTime('2015-12-04 17:02:10.4418 +00:00'); 
$microseconds = (float) $date->format('U.u'); 
echo $microseconds; //prints 1449248530.4418 
相關問題