-1

I have a problem with difference between two days.

How is it possible to get number of days?

Here is my code,

$start = date('Y-m-d', strtotime("+1 day"));
$end = date('Y-m-d', strtotime("+7 day"));
Ersoy
  • 8,816
  • 6
  • 34
  • 48
p43ck
  • 1
  • 2

1 Answers1

0

I use Pure PHP :

$start = date('Y-m-d', strtotime("+1 day"));
$end = date('Y-m-d', strtotime("+7 day"));
$diff = abs(strtotime($start) - strtotime($end));
$days = floor($diff/60/60/24);
$total = sprintf("%d days\n", $days);
return $total; // 6 days
STA
  • 30,729
  • 8
  • 45
  • 59