Posted By

daisuke103 on 04/07/09


php date textmate unix DateTime timestamp

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


PHP datetime タイムスタンプ形式でマイクロ秒まで取得する

 / Published in: Other

  1. list($micro, $Unixtime) = explode(" ", microtime());
  2. $sec = $micro + date("s", $Unixtime);
  3. $sec = mb_ereg_replace(sprintf('%d',$sec),"",($micro + date("s", $Unixtime)));
  4. echo date("Y-m-d H:i:s", $Unixtime).$sec;

Report this snippet  


RSS Icon Subscribe to comments
Posted By: Vordreller on April 7, 2009

Euhm... so what does this do exactly...

I could spend a lot of time debugging this, but it's just being friendly to post an explanation along with your code...

Posted By: Vordreller on April 7, 2009

So I tried it out and this piece of code will always print the current time in the MySQL DateTime format. Nice code, favorited.

You need to login to post a comment.