Microtime for standard date format

I have some values ​​that are milliseconds since the ie microtome(true) era in my MySQL database that go out as strings, I need to convert them to the standard PHP () date

 $updated = 1349697975.9381; $nUpdated = date($updated, "l jS F \@\ g:ia"); 

This returns an empty string, who can help?

+4
source share
2 answers

It should be date ( string $format [, int $timestamp = time() ] )

You have the wrong position

  $nUpdated = date("l jS F \@ g:ia",$updated); 

Output

 Monday 8th October @ 2:06 pm 
+9
source

You have date() arguments back (the timestamp is the second parameter).

Try updating:

 $nUpdated = date("l jS F \@ g:ia", $updated); 
0
source

Source: https://habr.com/ru/post/1438432/


All Articles