//Define the album date in a variable $albumDate = 2012-11-01; //Call to function albumExpired($albumDate);
4
15
16
17
18
// Show expired albums
function albumExpired($expiry){
// Find todays date.
$today = date("Y-m-d");
//Change date into a string
$todaysDate = strtotime($today);
// Change the album date into a string
$expiryDate = strtotime($expiry);
// compare the two dates (strings)
if ($expiryDate<$todaysDate){
return 'Expired';
}else{
return 'Not Expired';
}
}
No comments:
Post a Comment