JavaTechie

Its all about Technology

How can we know the number of days between two given dates using PHP? May 28, 2008

Filed under: PHP — javatechie @ 5:02 am
Tags:

$date1 = date(’Y-m-d’);
$date2 = ‘2006-07-01′;
$days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);
echo “Number of days since ‘2006-07-01′: $days”;

 

2 Responses to “How can we know the number of days between two given dates using PHP?”

  1. ravindra Says:

    strtotime() funtion need parameter

  2. Tun Tun Says:

    Thank , it is work perfectly


Leave a Reply