Expired date concept in php register user product or something expiry based on register date to current date. So i write the code in current date to expired date. count number of days between two dates and total number of days to check the conditions on expired date.
PHP
<?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"; } ?>
help me to calculate date to 5yrs i.e for ex if my start date iz 1-09-2015 then my expiry date should be 1-09-2020
ReplyDelete$end = date('Y-m-d', strtotime('+5 years'));
ReplyDelete