We help IT Professionals succeed at work.

Javascript alert if the date in a text field is less than ninety days from now

ddantes asked
I am not trained in scripting.  The online reservation system for my website includes a page (attached) with a text field "ArrDate".  I'd like an alert to pop up if someone enters a date which is less than ninety days from the current date.  Please provide instructions, if this is possible.
Watch Question

Try this code
var timestamp = new Date().getTime() + (90 * 24 * 60 * 60 * 1000)
//                                      day hour  min  sec  msec
var arrDate = \\fetch date here and getTime()
Compare that timestamp with the timestamp for the selected date.

if (timestamp > selectedTimestamp) {
    alert(' The selected time is less than 90 days')


Open in new window


Thank you for supplying that code.