|
-
Jul 25th, 2012, 09:39 PM
#1
[RESOLVED] If today, check if after 1 PM EST
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...
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
(note: on saturday, if after 12 EST then no good)
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!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|