LoginSignup
2
2

More than 5 years have passed since last update.

直書きphp で Unix日付の小数点以下をとるには

Posted at

お仕事で、wordpressが吐き出してるunix日付と同じ数字を、スクラッチなphpで出すことになった。
こういうの。

1234567899.9999

phpでただこうやってやると

echo time()

結果は

1234567899

しか取れないので、

list($micro, $unixtime) = explode(" ", microtime());
$unixtime = $unixtime + $micro;
echo $unixtime;

ってやった。
そんだけです。

2
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2