php compare dates

Solutions on MaxInterview for php compare dates by the best coders in the world

showing results for - "php compare dates"
Azalea
16 Apr 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 */ }
Simón
07 Mar 2016
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}
Jay
24 May 2020
1$date1 = new DateTime("now");
2$date2 = new DateTime("tomorrow");
3
4var_dump($date1 == $date2); // false
5var_dump($date1 < $date2); // true
6var_dump($date1 > $date2); // false
7
Bruno
10 Oct 2018
1$date_now = date("Y-m-d h:i:s");
2$variable = new DateTime($date_now);
3$to_compare = "2018-06-01 12:48:09";
4$variable1 = new DateTime($to_compare);
5$difference = date_diff($variable, $variable1)->format("Difference => %Y years, %m months, %d days, %h hours, and %i minutes");
6echo $difference;
Jonah
09 Feb 2018
1Select if(Date('2020-10-01') > Date('2020-11-01'), '1', '2' ) as rslt_date
Jaylin
22 Aug 2016
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 compare date is todayphp how to compare datesphp compare two date stringscomparing two dates in phpcompare 2 datetime objects phpfind greater date among two dates phpphp compare 2 dates without timephp compare to dateshow to compare current date and given date in phphow to match two date in phpdiff bw two date in phpphp get current date and comparemoment compare datescompare two date time in phpprogram to compare two month and year in phpphp function to compare 3 datesphp compare time stringshow to compare two dates php which are slightly seconds differenetphp date and time comparisonshow to compare two dates in if condition in phpphp how to compare date stringsphp compare datetime to nowphp compare date periodscompare string with date now phphow to compare two date ranges in phpcompare tow date in phpcompare two dats phphow to compare datetime objects in phpcompare dates pgphow to compare date and time in phpphp comare datesphp date compare todaycoparing time and date in phpdatetime compare dates phpcompare datetime objects phpphp compare sql datescurrent datetime comparison phpphp datediffhow to compare two date in phpdatetime compare in php from current datetimehow to compate timestap php best optionphp compare dates in arrayhow to compare two different date in phpdata to date compare php if conditioncompare two datetimes in phpdate comparesion in phpphp compare two new datetime objectshow compare two date in phpcompare length between date in phpcompare 2 date phpdiff date phpphp compare two datetimephp 7 5cdatetime comparelogical date comparison in phpcomparing date php d m yhow to date compare in phpdifference entre 2 dates phpcompare day with timestam phpphp mysql compare datescompare dates in php using datetime less thandate compare with current date in phpdiff bw two dates phpphp compare timestamp date onlyphp campare datecompare 3c and 3e date in phpphp confront datephp create array of dates between two datesphp compare two date objectscompare date with time phpphp compare two date stringcompare php datetimephp compare new datetimephp is datetime comparephp compare dates2 date compare phpcan i compare date strings in phpdate time comparison in phpphp compare two dates with timecanwe compare string in date in phpphp compare tow datescompare two dates and get difrrence in year in phpocompare 2 dates php y m dphp time comparecompare date and time with current date in phpcopare 2 dates phpcomparing dates in phpcompare to date phpphp compare datetime with current date timecompare 2 time phpcan we compare date with todatestring phpcompare date in php with time statementcompare format to a date phpcompare date php biggerphp datetime compare date onlycompare date in dabase and current date in phpphp date comparison not workingcan be two dates is compare in phpphp compare two dates to see if same daytimestamp date compare previous some date phpcompare date time column to current date time phpphp date comperphp compare datscomparing two date in phpphp datetime comparecompare php datescomparing 2 dates phpcompare datetime phpphp compare two datetime is less than todaycompare datetime with date phpphp compare latest to current datephp compare two dates greater thancompare today 27s date in phptimestamp comparison in phpcompare two date strings phpphp compare dates with 3ecomparing date time in phpcompare two time string php2 date time compare phpphp compare 2 date time stringscomparison between two dates in phpphp mysql query date comparisoncompare 2 date and time phpcompare 2 date mysql phpcurrent date from date and expiry date compare phpphp compare dates in stringcompare two date phptime compare phpdiff date in phpphp compare to datecompare two dates year in phpcurrent date comparison in phpphp compare date string to nowhow to comapre date in phpphp compare date time differancehtml php conpare datetime comparison in phpcompare two dates sin phpphp compare date and timecompare time 28 29 phpphp string date comparephp compare dates equalcompare to date ranges in phpcompare date time with null phpcompare two dates and minus phpphp equal datescompare date php d m yhow to compare date from database with current date in phpphp comparing several datescompare 2 datetime phphow to compare current date with other date in phpcompare two dates phpcomparer deux dates phpcompare datetime object phpphp date comparisonscompare 2 dates in phphow to compare a date and a date that is subtracted in phpcompare date php todayhow to compare date format in phpphp compare two datsphp compare date todayphp compare date stringsphp check if date is minor then todayphp comapre 2 datecompare dates in phpphp date comparetime compare in phpphp compare 2 datetimes are differentcompare days phpcompare two dates in phpcompare current date with another date in phpphp compare two datetime objectsif compare date phpcompare 2 date 2b phpphp time comparephp date string comparephp compare dates as stringphp diff between two datesphp comparing date timestampcan we compare dates in phpcompare current datetime phpcompare date php phpphp comapre datescompare two date string in phpphp compare mysql datetimecomparison between date phpphp compare 2 datephp compare date with todaycompare timestamp in phpcomapre date phpphp compare dates as stringscompare deux date en phpcompare 2 date time in phpphp function to compare datecompare date function script phpphp comparing datesphp compare datetime minuteshow to comapre with present date in phpcomparer 2 date phpphp 5cdatetime comparephp to compare two datesphp compare date and datetimehow to compare time in phpcomparing date in phpdate range php conditiondelete data compare time sql phpcompare two datetime in phphow to compare specific date from another date in phpphp current date comparedatetime comparison in phpcompare 2 dates phpcompare 2 date in phpget the difference between two dates in phpphp compare datcheck two date phpphp date diff datephp comapre two date and textcomparer dates en phpphp compare string datehow to compare dates phphow to get current date and compare it with future date in phpdate compareto in phpcomparer date en phpcompare date with current date in phpcompare date and time in phpcompare date php sqlhow to compare two date strings in phpphp compare two dates m yhow to find the difference between two dates datetime class in phpwhere date equals to date in phpdate range compare in phpcompare two datws in phphow to compare date time in phpcompare two str dates phpcan we compare two dates in phptime comparison phpcompare two timestamps phpphp compare with todaydate time match phpphp dateand month comparedifference two dates in phpphp logic in matching a data in different time or datecompare dates in phphphp comparing date stringsphp compare dates without timephp compare dates 3c 3d 3edate comparison in phpcomapre date in phpclasses with comparing dates phpcompare date script phpphp code compare datesdate comparison function in phphow to compare date value in phpcompare date and time phpphp compare formated dateshow to compare 2 date inm phphow to compare today date phpdata php comparisonphp compare dates with datetimehow to compare 2 dates in phpdates compare phpdate compare in phpcompare dates datetime phpphp compare date objectsdate match in phpcompare date phphow to compare two dated in phpcheck two date in phpphp compare current date with past dateselect where date equals to date in phpcompare datetime in php value from mysqlphp get dates between two datescomapre dates in phphow to comare created at date to simplae date in phpcompare date in phpcompare dates phphow to compare dates in phphow we compare teh two date using php functioncompair date in phpphp compare date and stringphp compare two datetimes who is biggerhow to compare if two date arre equals phptime less than comparison phpinteger comparison vs date phphow to compare which date is greater in php date comparisons in phpcompare two time phpcompare datetime with current datetime in phpcompare date time with now in php php datetime compare two datesphp datecomparestring dates compare phpphp compare dates equal to thancompare php mysql dateminits comparison of two dates in phpcompare between two date phpphp compare datetime mysqlcompare dates php d 2fm 2fyphp time comparisoncompare datetime in phpphp pass date to compare in mysqlcompare two datetime phpcompare two datetieme phphow to compare created at date with current date in phphow to compare tow date in phpcompare current date with date in phphow to compare days in phpcompare to current date in phpdatetime objects comparison phpdatetime compare phpcompare two dates and get the difference in phpcompare dates using phpcompare date and time with current date inphpbefore date comparison in phpstring date less than now phphow to compare date and time with old date and time in phpcompare date between two datetime phpdatetime comparison phptwo date compare in phpphp compare 2 dates timehow to compare data base and with current date in phpcompare two time in phpphp compare 2 string datescompare dates javascriptphp compare date with current date no time php equel datephp date comparison with current datesearch between two dates in sqlphp compare dates greater thanphp compare datetime with datecompare day datetime phpdiff date in phpcompare date php 7php datetime comparisoncompare two date in string phpphp compare date rangerscompare two array date difference in phpphp compare two datetime is less thanphp get range between two datephp get and compare datephp comparing current date if statementsphp compare dates if same daytwo date compare phpcompare data phphow does php compare dates 3fdatetime php comparecompare 2 dates in php month diff betweenphp sql comparing dateshow to compare timestamp in phpphp date compare to nowcompare two string dates phpcompare date and time with current date and time in phpcompare date phphp compare datetime objectsphp compare datetimesphp compare date to todayphp compare datetimecompare to date in phpdate compare phpcompare two timestamp phpcomparing sql datetime in phphow to check two date fields are in same date in phpcompare time phphow to compare two dates in phpbest way to compare dates in phpget difference between two dates in phpdate comparison phpphp compare string datescompare between 2 date in php php compare date and time get diff in intcomparing sql datetime in php and print if today date and timephp compare datecompare two date minutes phpphp compare date from mysql datephp get a todays date and compare itcompare onl time in phpphp compare two gmdatecompare to date in php output daycomparing dates using phpcompare dates same phpcompare date which is greatther than in phpphp compare datetime objectdate compare in php in secondscompare 2 dates 2b phpcompare sql datetime in phpcompare to dates phpcompare date in range phphp compare two datephp code for compare two date for get olderst datecompare two datetime objects phphow to compare date with current date in phpphp compare between two datesphp date comparisonphp check if 2 dates are olderhow compare date in phpphp compare two dates to see which is more recentphp compare two new datetimecomparing php datetimephp how to compare timecomparer 2 dates en phpcompare string to date phpcompare time phpcopmare two date object phpcompare time in phphow to compare date in pphpphp compare 2 dates less than or equal todaycompare two times phpphp compare 2 datetimescompare date with today phpcomparing datetime phpphp date compare stringphp compare 2 datetimes are equalsdatetime objects compare phpphp compare 2 datetimephp date compare with todayphp compare dates from dbphp date comparasioncompare with today date phpcomparison of date in phpphp compare date with current datestart date and end date compare in phpphp compare timephp compare date to nowphp comparing datetimescompare 2 date times phpcompare differences between two date phptwo dates difference in php comparecompare two date in php compare dates in php using datetimedate time comparision in phpcomparing dates phpphp date compare onlyconvert date string and compare in phpcompare two dates formats phpphp compare date yearhow to compare datetime with minutes in phpphp compare two datescompare 2 date in second phpdates in php comparetionphp datime compare 2 datescomparing dates in php nowphp compare date mysqlcompare sql date in phpdiff date php with datephp comparing datechange date to compare with date in database phphow to compare two dates phpcompare datetime from database phpcompare two datestime in phpcompare today date in phpcompare date time phpcheck php date comparecompare dates in array phpphp 7 compare datescompare two string date phpcan php compare two dateshow to compare date in phpphp date and time comparisoncompare date for loop in phpphp match two dateshow to compare two time in phpphp datetime compare datestimestampdiff between two dates sqlcompare between two day phpstring to date compare phpdate interval compare in phpcomparer deux dates en phpcomparing date strings phpphp logic 2c compare against specific datecompare two date strings in phpphp date equal todayphp compare sql datephp compare 2 datescompare string to datetime phpphp datetime compare 2 datescomparing sql datetime in php and print if today datecompare date in if phpcompare date time in phpcompare time php without datephp compare dates