vendredi 17 mai 2019

php compare start and end dates between two dates

Hi everyone:) i develop the rent module that rent the flats to users, i just want to check if the flat rent in two request dates, for examples , the flat rent from 2019-05-07 to 2019-08-07, when this flat rents again i want to check the start and end date not in the range of two dates i said above

i just write a condition to check the request dates and rent dates,

if($rent->endContract >= $request->startContract ||
  $rent->startContract <= $request->endContract) {
}

but this condition not work, for example when i want to rent similar flat to user from 2019-08-08 to 2019-11-08 in condition not work even though the dates are correct, please help me to find the best solution thanks alot



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire