I have a catalog variable named "Date" which is of the type date/time field. I need to write a onChange client script to verify the date/time is 2 hrs in advance from the current time.
I have tried below code but its is not calculating hours properly. Variable "twoHoursAgo " not calculating 2 hours before current time.
when I checked for month it is working fine.
Could anybody help on this?
var var1date = new Date(getDateFromFormat(g_form.getValue('date'),g_user_date_time_format));
alert(var1date);
var twoHoursAgo = new Date();
twoHoursAgo.getHours(twoHoursAgo.getHours() -2);