2

I am trying to convert a Mac UNIX timestamp to date time.

3448286095 should be converted to 2013-04-09 00:14:55.

I tried:

echo date('Y-m-d G:i:s', strtotime(3448286095));

The output is not correct.

UNIX Timestamp: seconds since Jan 1, 1970.
Mac Timestamp: seconds since Jan 1, 1904.

Kara
  • 6,115
  • 16
  • 50
  • 57
zeros-and-ones
  • 4,227
  • 6
  • 35
  • 54

1 Answers1

1

Well, another stupid Mac Timestamp-only approach:

date_default_timezone_set('UTC');
$date = new DateTime(gmdate('Y-m-d H:i:s', 3448286095));
$date->sub(new DateInterval('P66Y'));
echo $date->format('Y-m-d H:i:s');

which output:

2013-04-09 17:14:55
Raptor
  • 53,206
  • 45
  • 230
  • 366