compare dates datetime php

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

showing results for - "compare dates datetime php"
Klara
17 Nov 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 */ }
Alyssia
22 Jul 2019
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}
Victoria
27 Mar 2017
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
Gael
13 Mar 2020
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;
Hannes
07 Apr 2017
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 functioncompare 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 comparephp compare latest to current datecompare two date time in phpcompare between two day phpcopare 2 dates phpcompare 2 datetime phpphp compare dates in arraycompare dates in phphphp datetime compare 2 datescompare two time in phpcompare 2 date and time phpdatetime compare dates phpcurrent datetime comparison phpphp pass date to compare in mysqldate time comparision in phpcomparing 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 thanstring date less than now phpphp compare 2 datetimesphp compare 2 datetimes are equalshow to compare if two date arre equals phpphp compare two datetimecompare two datestime in phpphp compare timestamp date onlyget difference between two dates in phpcomparer 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 compare dates with timecompare date between two datetime phpphp sql comparing datesphp compare date and time get diff in intphp comparing date timestampphp compare date with current datephp compare two date stringsphp compare string datephp compare date is todaycompare dates in php using datetimephp 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 phpdate range php conditioncompare 3c and 3e date in phphow to compare date value in phpcompare with today date 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 timecompare two timestamp phpconvert 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 string datescoparing time and date in phphow 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 phpcompare whole date in phpphp function to compare datecan we compare date with todatestring phpcomparing 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 sqlphp compare date and timehow to compare timestamp in php2 date time compare phpphp comapre two date and textselect where date equals to date in phpphp 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 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 phpcompare day with timestam phpphp campare datecheck two date phpphp comparing date stringsphp 7 5cdatetime comparedatetime php comparecomparing dates in phpinteger comparison vs date phpphp compare datetimecomapre 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 phpdifference two dates 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 objectshow 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 phpcompare onl time in phpdiff bw two date in phpdate compare in php in secondshow to compare today date phpcompare 2 date 2b phpcompare two dates and get the difference in phpphp datediffcompare date php todaydates compare phpphp compare time stringshow to date compare in phpphp compare dates if same daychange date to compare with date in database phpcompare two datetieme phpcompare sql datetime in phpcomparison between two dates in phpcompare date in phpphp compare dates in stringmoment compare datescompare 2 time phpcompare date time column to current date time phphow to compare two dates in if condition in phpcomparing sql datetime in php and print if today date and timephp date compare onlydiff date in phphow to compare two date strings in phpcompare 2 date time in phpcompare dates in php using datetime less thanphp 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 phpphp 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 time php without 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 two datetime is less than todayphp compare date with todaycomparing two date in phpcompare dates in array phpcomparing 2 dates phpcompare 2 datetime objects phphow to compare data base and with current date in phpphp compare 2 dates less than or equal todayphp 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 datecompare date which is greatther than in phpcompare date in if 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 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 datelogical date comparison in phpphp compare two dateshow to compare current date with other date in phpphp get a todays date and compare itdate comparison phpcomparing sql datetime in php and print if today datetime compare in phphow to compare datetime with minutes in phpcompare dates javascriptphp compare two date objectswhere date equals to date in phpcomparing date time in phpcompare string with date now phpcompare two string date phpcompare date time with null phpcompare dates pgpcompare two date minutes phphow to compare created at date with current date in phpcompare 2 date in second phpphp date equal todayphp 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 phphow to compare date from database with current date 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 phpcompare date php phpcan php compare two dateshow compare two date in phpphp compare date from mysql datehow to get current date and compare it with future date in phpphp compare date time differancephp match two datestimestamp date compare previous some date phpphp date string comparecomparison between date phpcomparing php datetimecompare datetime phpphp compare 2 dates timehow 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 datephp date compare todaytwo 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 datephp compare between two dateshow to find the difference between two dates datetime class in phpphp compare two dates with timephp date comparisonscompare current date with another date in phpcompare to dates phpcurrent date comparison in phpcomparer 2 date phpphp compare date to nowcompare date function script phpphp compare two datetimes who is biggercompare date in dabase and current date in 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 datecompare string to datetime phpphp 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 datesdate time comparison in phpstart 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 comparecompare date in range phdate compareto in phpdatetime objects comparison phpphp compare two datsphp compare two dates to see which is more recentphp compare two datetime is less thanhow to comapre with present date in phpphp equel datehow to compare which date is greater in php compare dates datetime php