1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| $hour = substr($timestamp, 11, 2);
$minute = substr($timestamp, 14, 2);
$second = substr($timestamp, 17, 2);
$month = substr($timestamp, 5, 2);
$day = substr($timestamp, 8, 2);
$year = substr($timestamp, 0, 4);
$timestamp = mktime($hour,$minute,$second,$month,$day,$year);
$timestamphier = mktime(0,0,0,$month,$day-1,$year);
Tu peux alors vérifier avec la date du jour et la date d'hier :
$dateduforum = date("Y-m-d",$timestamp);
$datejour = date("Y-m-d");
$datehier = date("Y-m-d",$timestamphier);
if (strcmp($dateduforum,$datejour) == 0) {
C'est aujourd'hui...
} elseif (strcmp($dateduforum,$datehier) == 0) {
C'est hier...
} |
Partager