$start = new DateTime('2011-12-31 00:00:00'); $end = new DateTime('2021-01-01 00:00:00'); echo $end->getTimestamp() - $start->getTimestamp(); // output: 284169600