- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP program to find the total number of date between any two given dates
The ‘date_diff’ function can be used to get the difference between two dates. It is a built-in function that returns a DateInterval object if a specific number of days has been found, and returns False if the days is not found.
<?php $date_1 = date_create('23-11-2019'); $date_2 = date_create('22-1-2020'); $day_diff = date_diff($date_1, $date_2); echo $day_diff->format('The day difference is: %R%a days'); ?>
The day difference is: +60 days
Two dates are defined using the ‘date_create’ function and the difference/ the number of days that are present between these two dates can be computed using the ‘date_diff’ function. It is assigned to a variable and printed on the console.
- Python program to find number of days between two given dates
- PHP program to find number of days in every week between two given date ranges
- Find number of days between two given dates in C++
- Find the number of logins between two dates in MySQL
- PHP program to compare two dates
- How to find the number of days and number of weeks between two dates in R?
- Select the date records between two dates in MySQL
- How to search date between two dates in MongoDB?
- Get the SUM of records between two given dates in MySQL
- Return all dates between two dates in an array in PHP
- C# Program to get the difference between two dates
- PHP program to sort dates given in the form of an array
- PHP program to calculate the total time given an array of times
- MySQL date comparison to fetch dates between a given range?