Home › Forums › Back End › Countdown with php ? › Re: Countdown with php ?
May 30, 2011 at 12:56 pm
#74952
ddliu
Member
I agree with @TheDoc, at least you have to get user data from database(including when will the account expire).
Assuming you have got it and put it into a PHP variable “$expiration” and the format is UNIX timestamp.
So next you can use $expiration to calculate useful infomation:
1. Get the expiration date:
echo "Your account will be expired on ".date('m/d/Y',$expiration);
The output will be something like:
Your account will be expired on 06/01/2012
Read PHP manual to get more information on date: http://php.net/manual/en/function.date.php
2. Get datetime differenc
$diffSecs=$expiration-time();
...//continue with your countdown script...