I'm sure this is a very obvious question however I am really bad at working with timestamps and comparing them to in if statements.
What I am trying to do is define if a staff member has been on the team for 0-5 months
6-11 months
12-17 months
and 18+ months
And that is just meant to change the class of the table so
0-5 months is RED
6-11 months is ORANGE
12-17 months is BLUE
18+ months is GREEN
Here's my code so far, I'm sure it's completely wrong. The $dataResult['hire_date']
is the timestamp
when they were hired.
$milestone6 = strtotime("6 months ago");
$milestone12 = strtotime("12 months ago");
$milestone18 = strtotime("18 months ago");
if($dataResult['hire_date'] < $milestone6) {
//red?
} elseif($dataResult['hire_date'] < $milestone12) {
//orange?
} elseif($dataResult['hire_date'] < $milestone18) {
//blue?
} else {
//green?
}
Again thank you. It does not matter what order the if statements are in. Will mark as answered when I can.
Aucun commentaire:
Enregistrer un commentaire