This question already has an answer here:
Here is my question:
I have 2 datetime fields with the following values.
- n_date = '2015-11-06 00:00:00.000'
- ArrivalDate = '2015-11-06 01:00:00.000'
I want to compare only the date part of these fields so that the following:
if ($n_date!=$v[ArrivalDate]
{
do something ...
}
Does not do something
thx in advance!
</div>
Use strtotime()
for this,
if((date("Y-m-d",strtotime($n_date))) == (date("Y-m-d",strtotime($ArrivalDate)))) {
// both dtae are equal
} else {
// both date are not equal
}