0

Hi every body

i made news page in my Dreamweaver project and i added the date and time by this code

$time=(date("l dS \of F Y h:i:s A") . "<br />"); it is work correctly but, i wanna post it into other page some things like showing added news and so, i wanna expire the time some things like comments function

hope some body help me

many thanks

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by vibhaJ
0

You should really use timestamp. Makes it a lot easier to manipulate.

$cutoff = (cut off time you want it to stop);
$currenttime = time();
if ($cutoff > $currenttime) {
     // comments are disabled
}
0

1) when you save news also save expire date in database.e.g.
<?
$expDate = date('Y-m-d H:i:s', mktime(date("H"), date("i"), date("s"), date("m") , date("d")+7, date("Y"))); // expire after 7days
?>
2) where ever you are showing news in select query filter expire date for fetching news from db.e.g.
<?
$currDate = date('Y-m-d H:i:s');
$sql ="select * from news where expDate<='".$currDate."'";
?>

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.