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 [...]
PHP: Format and show an expiration date
April 8th, 2008 · No Comments
Tags: Code