PHP Check if current date is between two dates example

By Hardik Savani | October 9, 2019 | | 5852 Viewer | Category : PHP

In this example, i want to share with you small example of how to check current date is between startdate and enddate in php. we will check if today date is between two dates in php. we can simply check if current date is between two dates in php.

I written it very simple way so you can also use with laravel, codeigniter, zend php framework also. it's core php code for check if date is between two dates php.

Many times we require to check current date is between given two dates or not for subscription, trial, user expire time etc. so when user will register at that time will decide when he will expire and we will check it with current date always. so might be this post can help you to check if date exists between two dates in php.

You can check bellow simple example so it can help you.



$currentDate = date('Y-m-d');

$currentDate = date('Y-m-d', strtotime($currentDate));

$startDate = date('Y-m-d', strtotime("01/09/2019"));

$endDate = date('Y-m-d', strtotime("01/10/2019"));

if (($currentDate >= $startDate) && ($currentDate <= $endDate)){

echo "Current date is between two dates";


echo "Current date is not between two dates";


If current date is 09/10/2019 than it will return bellow output:


Current date is between two dates

I hope it can help you...

Tags : Example PHP

Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: