SL8R.co.uk - Code Zone

Code, Code and Code

SL8R.co.uk - Code Zone header image 4

PHP: Format and show an expiration date

April 8th, 2008 · No Comments

A useful routine to calculate and show an expiration date based on a given number of hours
// Hours to expiration
$iHrs = 72;
// Date from database
$dbDate = ‘2008-04-08 16:53:19′;
// obtain current date and time
$iTimeNow = date(”U”);
// calculate expiry time
$iExpiryTime = ($iHrs * 3600) + strtotime(”$dbDate”) ;
// set the message to display
$strMessage = “”;
// compare times
if ($iTimeNow [...]

[Read more →]

Tags: Code