date comparison function in php

Solutions on MaxInterview for date comparison function in php by the best coders in the world

showing results for - "date comparison function in php"
Kessy
31 Feb 2019
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 */ }
Iker
12 Jun 2016
1dev:~# php
2<?php
3date_default_timezone_set('Europe/London');
4
5$d1 = new DateTime('2008-08-03 14:52:10');
6$d2 = new DateTime('2008-01-03 11:11:10');
7var_dump($d1 == $d2);
8var_dump($d1 > $d2);
9var_dump($d1 < $d2);
10?>
11bool(false)
12bool(true)
13bool(false)
14dev:~# php -v
15PHP 5.2.6-1+lenny3 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 26 2009 20:09:03)
16Copyright (c) 1997-2008 The PHP Group
17Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
18dev:~#
Brogan
31 Nov 2020
1Select if(Date('2020-10-01') > Date('2020-11-01'), '1', '2' ) as rslt_date
Melina
05 May 2019
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}
queries leading to this page
php date comparephp comparing datetimesdatetime objects compare phptwo dates difference in php comparephp compare 2 dates without timehow we compare teh two date using php functionhow to comare created at date to simplae date in phpcompare date php sqlphp compare two date stringphp compare datetime with datecomparing dates using phpcompare two datetime in phpcompare two timestamps phpcompare sql date in phphow to compare 2 dates in phpphp 5cdatetime comparecompare two date time in phpcompare between two day phpcopare 2 dates phpcompare 2 datetime phpphp compare dates in arraycompare dates in phphsymfony compare two datesphp datetime compare 2 datescompare two time in phpphp comparint datetimmehow to compare two datetime phpdatetime compare dates phpcurrent datetime comparison phpphp pass date to compare in mysqlcomparing date strings phpdiff date phpphp compare dates as stringsphp code for compare two date for get olderst datephp compare date mysqlcompare two array date difference in phpphp compare dates greater thanphp compare 2 datetimesphp compare 2 datetimes are equalshow to compare if two date arre equals phpdate comparesion in phpphp compare two datetimecompare two datestime in phpget difference between two dates in phpdatetime diffcomparer deux dates phpcheck php date comparecan we compare dates in phpphp compare date to todaycompare 2 dates 2b phpcompare two string dates phpfind greater date among two dates phphow to match two date in phpcomapre date phphow to compare date with current date in phpphp sql comparing datesphp comparing date timestampphp compare date with current datephp compare two date stringsphp compare string datephp compare datetime objectscompare two datetime objects phpphp comparing datephp compare date todayphp compare date rangersphp compare two dates m yhow to compare tow date in phpphp compare with todaycompare deux date en phpphp compare two dates to see if same dayphp date compare stringphp compare dates equalphp compare date periods2 date compare phpcompare 3c and 3e date in phphow to compare date value in phpphp compare datetime with current date timecompare dates same phpcanwe compare string in date in phpcompare current datetime phpphp to compare two datescompare date php d m yphp compare dates without timephp comare datetimeconvert date string and compare in phpphp compare new datetimecompare datetime with date phpcompare two dates sin phpcompare dates phpphp current date comparephp compare 2 date time stringsphp comapre 2 datephp compare dates and timephp compare string dateshow to compare current date and given date in phpclasses with comparing dates phpcompare two date in string phpphp is datetime comparehow to compare two different date in phpcompare date and time in phpphp comparing datesphp compare 2 datetimecomparer 2 dates en phpphp function to compare datecomparing dates in php nowcompare 2 dates in php month diff betweencompare 2 date in phpphp datetime compare two datesdate compare phpdate comparisons in phphow compare date in phpphp compare datphp compare date with current date no time search between two dates in sqlhow to compare timestamp in php2 date time compare phpphp comapre two date and textphp mysql compare datesphp datetime compare date onlyphp compare mysql datetimediff date in phpdatetime comparison in phpcompare time phpcompare php datescomparer dates en phpcompare 2 dates phpphp compare dates from dbcompare datetime from database phptime comparison phpphp date compare with todaystring to date compare phpcompair date in phpcompare date phcompare two dates and minus phpcompare date in php with time statementcompare time in phphow to compare time in phpphp comparing datetimephp campare datecheck two date phpphp comparing date stringsphp 7 5cdatetime comparedatetime php comparecomparing dates in phphow to compare datetime date in phpphp compare datetimeinteger comparison vs date phpcomapre date in phpcompare two dates in phpcompare date and time with current date inphpcompare datetime in phpcompare two dates year in phpdate compare with current date in phpcompare two datetime phpcompare date php biggerphp compare date and datetimephp time comparecompare 2 dates php y m dphp compare datetime minutesphp compare date and stringcompare timestamp in phpcompare to date phpphp how to compare datescompare 2 date mysql phpcompare to date ranges in phpcompare datetime objects phpphp compare dates equal to thancompare two dats phpdate match in phpdatetime comparison phpminits comparison of two dates in phpcompare datetime object phpcompare two date strings phphow to compare 2 date inm phpcompare current date with date in phpcompare date for loop in phphow to check two date fields are in same date in phpphp date and time comparisonshow to compare a date and a date that is subtracted in phpcompare dates using phpphp compare two datetime objectsphp date comparison not workinghow does php compare dates 3fphp compare dates as stringcan be two dates is compare in phphow to compare two dates php which are slightly seconds differenetcompare date script phpcan i compare date strings in phpsymfony 4 compare datetimeinterface with datetimecompare onl time in phpdiff bw two date in phptime comparison in phpdate compare in php in secondshow to compare today date phpcompare 2 date 2b phpcompare two dates and get the difference in phpphp datediffdate comparaisation phpcompare date php todaydates compare phpphp comparar duas datetimephp compare time stringshow to date compare in phpphp mysql query date comparisonphp compare dates if same daycompare two datetieme phpcompare sql datetime in phpcomparison between two dates in phpcompare date in phpphp compare dates in stringmoment compare datescompare 2 time phphow to compare two dates in if condition in phpphp date compare onlydiff date in phphow to compare two date strings in phpcompare 2 date time in phpphp compare datetime mysqlcompare to date in phpphp time comparephp compare sql datediff bw two dates phpphp equal datesstring dates compare phpcompare 2 dates in phpcompare date with time phpdata php comparisonphp time comparisonphp logic in matching a data in different time or datephp date compare to nowphp get current date and comparecompare two date strings in phpcompare date with today phpphp function to compare 3 datescompare two date string in phpphp compare tow datescompare differences between two date phpphp compare datscompare data phphtml php conpare datecompare today 27s date in phpcomparison of date in phpbest way to compare dates in phpdiff date php with datecompare date and time with current date in phpcompare between 2 date in php php check if 2 dates are olderphp comapre datesphp comparing several datesphp compare date with todaycomparing two date in phptimestamp comparison in phpcompare dates in array phpcomparing 2 dates phpcompare 2 datetime objects phpphp date comparasioncomparing datetime phpphp date compertwo date compare phpphp comare datesphp compare two new datetime objectscomparing sql datetime in phpcompare date with current date in phphow to comapre date in phpphp compare date stringsprogram to compare two month and year in phpphp datecomparecomparing date in phpphp date and time comparisonphp compare 2 datephp get range between two datephp datetime compare to nowcompare date which is greatther than in phpcompare php datetimecompare dates php d 2fm 2fyhow to compare two date ranges in phpphp compare date yearcompare two time phpcompare date time phpdata to date compare php if conditionphp compare date objectsphp diff 2 datetimephp check if date is minor then todayphp how to compare timecompare php mysql datephp create array of dates between two datesphp compare two datephp compare to datesdates in php comparetioncomapre dates in phphow to compare date time in phphow to compare two dated in phpphp get dates between two datescompare date and time phphow to compare two dates phpcompare two date phpphp compare two gmdatecomparer deux dates en phpcompare between two date phpphp compare 2 datetimes are differentcompare date time with now in php before date comparison in phpcompare date php 7compare 2 date phphow to compare days in phpphp datetime compare dateshow to compare dates phpdatetime compare in php from current datetimecompare time phpcompare two str dates phphow to compare two dates in phpcompare two time string phpphp diff between two datesdate comparison in phpphp compare date string to nowphp compare 2 string datesphp date comparison with current datephp new datetime comparelogical date comparison in phpphp compare two datesdate comparison phptime compare in phphow to compare datetime with minutes in phpcompare dates javascriptphp compare two date objectscomparing date time in phpcompare string with date now phpcompare two string date phpcompare two dates formats phpcompare dates pgpcompare two date minutes phphow to compare created at date with current date in phpcompare 2 date in second phpphp compare formated datescompare dates in phphow to compare datetime objects in phpphp compare datetimescomparer date en phpphp get and compare datecompare two dates phphow to compare date format in phpdate range compare in phpcheck two date in phpcompare tow date in phphow to compate timestap php best optionphp 7 compare datescompare two dates and get difrrence in year in phpocompare length between date in phpphp compare datestime compare phpmake database date comparable with new date phpcompare date php phpcan php compare two dateshow compare two date in phpphp compare date from mysql datephp compare date time differancephp match two datesphp date string comparecomparison between date phpcomparing php datetimecompare datetime phphow to compare two time in phpdate interval compare in phpcompare string to date phpcomparing date php d m ydate comparison function in phphow to compare date and time with old date and time in phphow to compare date in pphpphp datetime comparisoncompare 2 date times phpdifference entre 2 dates phpcompare time 28 29 phpcompare two datetimes in phpphp compare dates with datetimecomparing dates phpcompare date time in phpcompare datetime in php value from mysqlget the difference between two dates in phpphp comparing current date if statementscompare to date in php output dayphp compare two new datetimecan we compare two dates in phpcompare two times phpphp compare dates 3c 3d 3ephp compare to datetwo date compare in phpphp date comparisondate compare in phpphp confront datephp compare 2 datesphp compare datetime to nowphp dateand month comparecomparing two dates in phpcompare two datws in phpphp logic 2c compare against specific datedatetime php comparisonsphp compare between two dateshow to find the difference between two dates datetime class in phpphp code compare datescompare format to a date phpphp compare two dates with timephp date comparisonscompare to dates phpcurrent date comparison in phpcomparer 2 date phpdelete data compare time sql phpphp compare date to nowcompare date function script phpcompare two date in php php compare dates with 3ecompare date and time with current date and time in phpphp compare timephp string date comparecurrent date from date and expiry date compare phphow to compare dates in phpphp date diff datephp compare datetime objectphp compare current date with past datecompare dates datetime phpcompare datetime with current datetime in phphow to compare date in phpphp how to compare date stringsphp compare datephp datime compare 2 datesstart date and end date compare in phpcompare today date in phpphp compare sql datescompare day datetime phpcopmare two date object phpdatetime compare phpif compare date phpphp compare two dates greater thancompare date phphow to compare specific date from another date in phpdate time match phpcompare days phphow to compare date and time in phptimestampdiff between two dates sqlcompare to current date in phphow to compare two date in phpphp datetime comparedatetime compare two dates phpcompare date in range phdate compareto in phpdatetime objects comparison phpphp compare two datsphp compare two dates to see which is more recentphp compare dattimlephp compare two datetime is less thanhow to comapre with present date in phpphp equel datehow to compare which date is greater in php date comparison function in php