9951 explained code solutions for 126 technologies


phpFind difference between two dates in days


$days = (new DateTime($first))->diff( new DateTime($second) )->format('%a');ctrl + c
$days

number of days between two dates will be returned here

DateTime

system object to manipulate dates/times

$first

later date

$second

earlier date

'%a'

return number of days