Monday, 20 July 2015

PHP: Expiry date code

<?php
    date_default_timezone_set ("Asia/Calcutta");
    $dateofreg1=date("M d Y");
    $puechese_date="08/13/2014";
    $startTime = strtotime($puechese_date);
    $endTime = strtotime($dateofreg1);
    $timeDiff = abs($startTime-$endTime);
    $numberDays = $timeDiff/86400;
    $numberDays = intval($numberDays);
    $validays="90";
    if($numberDays>$validays)
        {
        echo "Product Valid";
        }
    else
        {
        echo "Product Expired";
        }
?>

0 comments:

Post a Comment