0

I have 2 timestamps (like 3434368673) an want to get the days between them. How can I do that?

Thanks!

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
EOB
  • 2,975
  • 17
  • 43
  • 70

2 Answers2

6

Use the Julian Day

$days = unixtojd($t1) - unixtojd($t2);
Rob Agar
  • 12,337
  • 5
  • 48
  • 63
3
$days = (int) ( abs($timestampA - $timestampB) / ( 60 * 60 * 24 ) );
hsz
  • 148,279
  • 62
  • 259
  • 315
  • This returns me 415000 days for example ... it needs more brackets, but its working. It has to be (60 * 60 *24). – EOB Jan 24 '12 at 13:32