php compare two dates
$today = date("Y-m-d");
$expire = $row->expireDate; //from database
$today_time = strtotime($today);
$expire_time = strtotime($expire);
if ($expire_time < $today_time) { /* do Something */ }
php compare two dates
$today = date("Y-m-d");
$expire = $row->expireDate; //from database
$today_time = strtotime($today);
$expire_time = strtotime($expire);
if ($expire_time < $today_time) { /* do Something */ }
php date compare with today
<?php
$datetime1 = new DateTime('2009-10-11 12:12:00');
$datetime2 = new DateTime('2009-10-13 10:12:00');
if ($datetime1 > $datetime2) {
echo 'datetime1 greater than datetime2';
}
if ($datetime1 < $datetime2) {
echo 'datetime1 lesser than datetime2';
}
if ($datetime1 == $datetime2) {
echo 'datetime2 is equal than datetime1';
}
php compare date
<?php
$datetime1 = new DateTime('2009-10-11 12:12:00');
$datetime2 = new DateTime('2009-10-13 10:12:00');
if ($datetime1 > $datetime2) {
echo 'datetime1 greater than datetime2';
}
if ($datetime1 < $datetime2) {
echo 'datetime1 lesser than datetime2';
}
if ($datetime1 == $datetime2) {
echo 'datetime2 is equal than datetime1';
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us