how can find out the difference between time, for example the appointment time is
4:30 PM but i want to send a notification via cron job 30 mins ,15 mins or 5 mins
before 4:30 PM
but i cant figure out how to get the time difference so that i can make an if statement to notify for ex if set to 30 mins the email will be sent at 4:00 PM
ex:
$setting = "30 minute";//set to notify 30 min before appointment
$notiftime = "4:30 PM";//time of the appointment
$notiftime = strtotime($notiftime);
$difference = strtotime( '-' $setting , $notiftime);
$current = date('h:ia'); //gets current time
$current = strtotime($current);
if ( $current <= $difference){
//send email script=======
}
Here's what you want:
$appointment = "4:30 PM";//time of the appointment
$delay = 30 * 60; //set to notify 30 min before appointment
$appointment = strtotime($appointment);
$notifytime = date('h:ia', $appointment - $delay);