Here's my dilemma. my wifes flower shop has a delivery cut off at 1 PM EST. I need to check if the date is today... and if its after 1.
I can figure out how to check the time, because the person ordering could be in another time zone.
so, the delivery date is passed through post to a payment page as $delivery_date (php). Now, the user could start the order at noon, but wait an hour + before finishing and hitting submit on the payment page. So, how do i check the date ($delivery_date) and then, if its today, check if its after 1 PM EST. if so, dont submit and alert them.
I would assume JS would be best since i can do it on the form submit for validation....
i have code that stops the user from selecting today if after one, when they are at the delivery info page.
i THINK this is correct for taking into account the timezone...
(note: on saturday, if after 12 EST then no good)Code:var offset = -4.0; var clientDate = new Date(); var utc = clientDate.getTime() + (clientDate.getTimezoneOffset() * 60000); var d = new Date(utc + (3600000*offset)); if (dayOfWeek == 6 && d.getHours() > 12 || d.getHours() > 13) { etc etc
so how do i do it if the date value (ex: 7/30/2012) is stored in a POST or in a PHP variable.
thanks!


Reply With Quote