Hi,
I have used the mktime() function for a number of years but I hear it is now deprecated in PHP5. Does anyone have an PHP5 compliant method for comparing a submitted date in a form to the 'now' date as well as comparing it with days of the week.
Here is my existing code:
if (checkdate($_POST['delivery_date_month'], $_POST['delivery_date_day'], $_POST['delivery_date_year'])){
$epochdate = mktime(0,0,0,$_POST['delivery_date_month'], $_POST['delivery_date_day'], $_POST['delivery_date_year'], 0);
$delivery_date=$_POST['delivery_date_year'].'-'.$_POST['deliveryl_date_month'].'-'.$_POST['delivery_date_day']; // MySQL Date Format
$ampm = $_POST['ampm'];
// Check for order date against minimum delivery date
$min_del_date = date("Ymd", strtotime("+2 day"));
if (date("Ymd", $epochdate) < $min_del_date){
$message .= 'We cannot deliver on this day ('.date("d-M-Y", $epochdate).'). Please enter a delivery date at least 2 working days from now. If you require next day delivery please phone and we will try to help.';
$delivery_date = NULL;
} elseif (date("D", $epochdate) == 'Sun'){
$message .= 'We do not deliver on a Sunday. Please enter a delivery date on an alternate day.';
$delivery_date = NULL;
}
}
Thanks