Majid Sadr
Majid Sadr

Reputation: 1081

PHP - get milliSecond from Timestamp

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

Upvotes: 2

Views: 3499

Answers (2)

Gynteniuxas
Gynteniuxas

Reputation: 7103

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

Upvotes: 2

Ankit Doshi
Ankit Doshi

Reputation: 1174

You may try below code from source

$now = DateTime::createFromFormat('U.u', microtime(true));
echo $now->format("m-d-Y H:i:s.u");

Upvotes: 1

Related Questions