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

Answer Posted / vipul dalwala

php
-------------------------------------------------------
$noofdays = ceil(((strtotime($endDate) - strtotime
($startDate)) / (60*60*24)))


Mysql
-------------------------------------------------------
SELECT ((UNIX_TIMESTAMP('2007-10-01') - UNIX_TIMESTAMP
('2007-09-04'))/(60*60*24)) AS dateDiff;

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is the dependent variable?

494


How can we destroy the cookie in php?

535


How a variable is declared in php?

518


What are the uses of explode() and implode() functions?

535


Write a program in php to print a table of a number?

509






Why we use get in php?

570


How does the identity operator ===compare two values in PHP?

653


Tell me what is the use of isset() in php?

548


What are html entities?

509


What is php mainly used for?

535


What is a static variable in php?

536


How can we define a variable accessible in functions of a php script?

553


What is alias in php?

555


Explain about getters and setters in php?

535


What is list in PHP?

648