2

I want to get current Timestamp with millisecond. but date() returns Timestamp just with seconds.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Majid Sadr
  • 911
  • 7
  • 18
  • [time()](http://php.net/manual/en/function.time.php) – Bonatti May 25 '16 at 11:16
  • 1
    @Bonatti This question is about millisecond but you duplicated my question with a question about date/time (just second) – Majid Sadr May 25 '16 at 11:18
  • Read the answers, specially about time() functions. This question shows no effort to Google what time functions exists in PHP, so I just marked one that has the issue. – Bonatti May 25 '16 at 11:20

2 Answers2

2

You can use microtime (which is better solution because you will get exact value).

Gynteniuxas
  • 7,035
  • 18
  • 38
  • 54
1

You may try below code from source

$now = DateTime::createFromFormat('U.u', microtime(true));
echo $now->format("m-d-Y H:i:s.u");
Community
  • 1
  • 1
Ankit Doshi
  • 1,164
  • 3
  • 21
  • 43