5

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?

Josua Marcel C
  • 3,122
  • 6
  • 45
  • 87
Justin Erswell
  • 688
  • 7
  • 42
  • 87

2 Answers2

10

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
Baba
  • 94,024
  • 28
  • 166
  • 217
0

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

Try updating to:

$nUpdated = date("l jS F \@ g:i a", $updated);
newfurniturey
  • 37,556
  • 9
  • 94
  • 102