• Register
Welcome to phpanswers , where you can ask questions and receive answers from other members of the community.

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

0 votes
asked 2 years ago by Neeraj Narkhede (1,670 points)

2 Answers

0 votes
PHP dont provide any specific function like MySQL. If you are compairing the dates with database then It's recommendated that use the DATEDIFF() function from MySQL cos it's more efficient cos it will give u the diff directly you dont have to process the output for date difference.
answered 2 years ago by vikramapte (1,980 points)
0 votes
(strtotime($date1) - strtotime($date2)) / (60 * 60 * 24);
answered 9 months ago by anonymous

Related questions