hey there i want to print a string like "live" , "upcoming" etc based on date and time
if the article date and time is equal to the current date and time it will print live if the date or time is gone then show nothing if the date is not still come then show upcoming here is my script :
/*--------------------------------------------------------*/
/*Validating time to print live or upcoming etc*/
/*--------------------------------------------------------*/
if($article_date >= $today_date) {
if($today_hours < $article_shours) {
$status = "<p class='upcoming'>1Coming Soon</p>";
}
elseif(($today_hours >= $article_shours) && ($article_date == $today_date)) {
if( ($today_hours >= $article_shours) && ($today_minutes >= $article_sminutes) ) {
$status = "<p class='live'>2live</p>";
} else {
$status = "<p class='upcoming'>3Coming soon</p>";
}
if($today_minutes >= $article_sminutes) {
$status = "<p class='live'>4live</p>";
}
} else {
$status = "<p class='upcoming'>6Coming soon</p>";
}
} else {
$status = "<p class='upcoming'>7Coming soon</p>";
}
if($article_date < $today_date) { // if the date is passed then do nothing
if( $today_date > $article_end_date) {
$status = "8";
}
}
/*--------------------------------------------------------*/
/*Validating time to print live or upcoming etc ENDS here*/
/*--------------------------------------------------------*/
But there are still some problems it is not working well I will thankfull if someone can solve my code or refer me another code
Aucun commentaire:
Enregistrer un commentaire