How can I disable a link when the expiry date has passed? My plan is to use an if-else statement to compare the dates in a table with the current date. Ideally, I would like to notify the user one day before, on the same day, and one day after the expiry date
$current_date = "2018-07-23 12:00:00";
$expiry date = "2018-07-22 12:00:00";
if($expiry date>$current_date){
$link = "
$date1 = new DateTime("2007-03-24");
$date2 = new DateTime("2009-06-26");
$interval = $date1->diff($date2);
function dateDiffInDays($date1, $date2) {
$diff = strtotime($date2) - strtotime($date1);
return abs(round($diff / 86400));
}
// Start date $date1 = "2021-03-01 04:03:00";
// End date $date2 = date('Y-m-d');
$dateDiff = dateDiffInDays($date1, $date2);
$date1 = '2024-02-29';
$date2 = '2024-03-03';
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
$days = abs(round($diff / 86400)); ( this line enough for getting number of days )
echo $years*365+$months*30+$days; // 3 days
printf("%d years, %d months, %d days\n", $years, $months, $days);