View Single Post
Old 02-23-2011, 02:58 PM  
georgeyw
58008 53773
 
georgeyw's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: Australia
Posts: 9,864
congrats - have done 37 days here, started using the ecigs and now have forgotten about them.
Put the code below on one of your sites - tells you number of days you have quit, money saved and cigs not smoked. Good motivator

PHP Code:
<?
function dateDiff($dformat, $endDate, $beginDate)
{
    $date_parts1=explode($dformat, $beginDate);

    $date_parts2=explode($dformat, $endDate);

    $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);

    $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);

    $vartext =  ($end_date - $start_date)+1;
    return $vartext;
}

$date1="01/18/2011"; // DAY YOU QUIT SMOKING MM/DD/YYYY 
$date2=date('m/d/Y'); //mm/dd/yyyy
$datediff = dateDiff("/", $date2, $date1);
// number of days quit
echo "Days quit smoking : " . $datediff . " days.<br>";
// cost per packet of cigarettest
echo "$".($datediff * '17.5')." saved by not smoking.<br>";
// number cigarettes smoked per day
echo ($datediff * 25) . " cigarettest not smoked since quitting.";

?>
georgeyw is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote