I have a form with two buttons and would like to check the time elapsed between the pushing of the first to the second. I want to make sure that they are both pushed within like 4 hours. I figure I'll probably need a hidden field to use as a date stamp for the first button. I just don't know how to figure out if two times are within a certain range.
You can use a global Date variable. You set it when the first button is
pushed, and then calculate how much time had passed when the second one is
You can read about the JS's Date object here:
First button is thus:
global.startTime = new Date().getTime();
totalTimeInMS = new Date().getTime() - global.startTime;
totalTimeInHours = totalTimeInMS / 3600000;