1$today = date("Y-m-d");
2$expire = $row->expireDate; //from database
3
4$today_time = strtotime($today);
5$expire_time = strtotime($expire);
6
7if ($expire_time < $today_time) { /* do Something */ }
1<?php
2
3$datetime1 = new DateTime('2009-10-11 12:12:00');
4$datetime2 = new DateTime('2009-10-13 10:12:00');
5
6if ($datetime1 > $datetime2) {
7 echo 'datetime1 greater than datetime2';
8}
9
10if ($datetime1 < $datetime2) {
11 echo 'datetime1 lesser than datetime2';
12}
13
14if ($datetime1 == $datetime2) {
15 echo 'datetime2 is equal than datetime1';
16}
1$date1 = "2021-01-15";
2$date2 = "2021-01-18";
3
4if ($date1 < $date2) {
5 echo "$date1 is earlier than $date2";
6} else {
7 echo "$date1 is later than $date2";
8}