How can we know the number of days between two given dates
using PHP?

Answer Posted / savvy

"The function expects to be given a string containing a US
English date format and will try to parse that format into a
Unix timestamp (the number of seconds since January 1 1970
00:00:00 GMT), relative to the timestamp given in now, or
the current time if none is supplied." --- in php.net So Be
careful when calculating with strtotime(). Therefore in the
above ans it might be like this way
$date1 = date('M-d-Y');
$date2 = "August-07-2007";

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to get complete current page url in php?

557


can we swap two different string using php for example:-- before swapping:-- 1 string :-hello friend, 2 string :-my dear, after swapping that strings will be: 1.hello dear, 2.my friend.

3075


Does exist in php?

541


Where are cookies stored php?

507


What is php form validation?

558






Tell me how to create a text file in php?

549


Is php an api?

535


What is php mean?

570


Can a super () and this () keywords be in same constructor?

487


Why do we use csrf token?

519


Explain how to run the interactive php shell from the command line interface?

556


How to define a user function?

574


What is an operator in php?

574


How many days will it take to learn php?

532


What is a query give example?

525