Q:

Write a PHP script to calculate number of days between two dates

0

Write a PHP script to calculate number of days between two dates.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$to_date = time(); // Input your date here e.g. strtotime("2014-01-02")
$from_date = strtotime("2012-01-31");
$day_diff = $to_date - $from_date;
echo floor($day_diff/(60*60*24))."\n";
?>

Sample Output:

1988

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now