Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

microtime to standard date format

I Have some values which are milliseconds since epoch i.e. microtime(true) in my MySQL database these are got out as strings I need to convert them over to a standard PHP date()

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

This is returning a blank string, anyone help?

like image 286
Justin Erswell Avatar asked Oct 08 '12 14:10

Justin Erswell


1 Answers

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

You got the position wrong

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

Output

Monday 8th October @ 2:06 pm
like image 69
Baba Avatar answered Nov 19 '22 16:11

Baba