jeudi 2 mars 2017

Check if date is in the past or future [duplicate]

This question already has an answer here:

I have the date in this format 30-01-17, I am trying to check if this date is in the past or future.

I currently have this:

$now = time();
if(strtotime($value['10working']) < $now) {
     $applicationtext = 'in the past';
}
        if(strtotime($value['10working']) > $now) {
     $applicationtext = 'in the future';
}

Is there a problem with the above, it seems to be giving incorrect results, is there a better/correct way of doing this? Or should the date be in a different format, is there a way to change the format if so?

Any help would be great!

Aucun commentaire:

Enregistrer un commentaire