Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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 */ }
Comment

php compare dates

$date_now = date("Y-m-d h:i:s");
$variable = new DateTime($date_now);
$to_compare = "2018-06-01 12:48:09";
$variable1 = new DateTime($to_compare);
$difference = date_diff($variable, $variable1)->format("Difference => %Y years, %m months, %d days, %h hours, and %i minutes");
echo $difference;
Comment

compare php date with mysql date

$today = date("Y-m-d");

$sql_query = "SELECT * FROM orders WHERE expireDate <=".strtotime($today);
Comment

php compare dates

$date1 = "2021-01-15";
$date2 = "2021-01-18";

if ($date1 < $date2) {
 	echo "$date1 is earlier than $date2";
} else {
	echo "$date1 is later than $date2";
}
Comment

date comparison function in php

Select if(Date('2020-10-01') > Date('2020-11-01'), '1', '2' ) as rslt_date
Comment

PREVIOUS NEXT
Code Example
Php :: trim php 
Php :: assert symfony 
Php :: send email verification nootification laravel 
Php :: laravel enable query log 
Php :: cpanel composer update kill 
Php :: doctrine where 
Php :: what is the use of closure function in php 
Php :: php fn closure 
Php :: str_contains — Determine if a string contains a given substring 
Php :: what is isset in php 
Php :: laravel flash message 
Php :: how to run a php file using 
Php :: wordpress basic auth 
Php :: Code to check Check whether a year is leap year or not 
Php :: run cron job in seconds 
Php :: twig url 
Php :: laravel routes 
Php :: how to develop package beside laravel project 
Php :: PHP Notice: Trying to get property of non-object 
Php :: how to give points to referrer in laravel 
Php :: advanaced layout builder enfold custom post type 
Php :: search line phpstorm mac 
Php :: Storing login info in a session 
Php :: laravel create multiple request 
Php :: count vs sizeof php 
Php :: discord.py Levels 
Php :: php blade first child @foreach 
Php :: IlluminateDatabaseEloquentMassAssignmentException with message 
Php :: php how to loop through array_rand 
Php :: vault deployment in production 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =