Jump to content

countdown from time in database


techker

Recommended Posts

hey guys  im made a scanning system that when the member scans his id card it gets info from the databse

 

nam and if there is a message in his file.

 

i want to add an alert like there is x day's left to the end of your contract..

 

i have in the databse the created date and the end date.

 

how can i calculate the remeinder of days ?

Link to comment
https://forums.phpfreaks.com/topic/146841-countdown-from-time-in-database/
Share on other sites

i found this but i can't seem to modify it for me?

 

function countdown($event,$month,$day,$year) {
// subtract desired date from current date and give an answer in terms of days
$remain = ceil((mktime(0,0,0,$month,$day,$year) - time()) / 86400);
// show the number of days left
if ($remain > 0) {
print "<p><strong>$remain</strong> more sleeps until $event</p>";
}
// if the event has arrived, say so!
else {
print "<p>$event has arrived!</p>";
}
}

// call the function
countdown("Christmas Day", 12, 25, 2008);  

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.