RE: JavaScript Date Code (check date selected). Alyssa K 3.Mar.03 06:49 PM a Web browser Question 2.0.8Windows NT
Thanks for the time tip.
However when i select a date using the date picker.. i.e. 14/03/2003 (14th of March 2003), the script returns the wrong date, month, year.
The javascript returned 3rd of Jan 2004. There is no time as the date picker does not return this information.
Here is my sample code just to see the output of the field and trying to compare it to today.getTime. It seems my main problem is trying to retrieve the information from quickplace in the same format as the javascript functions(mm/dd/yy), or using an alternate javascript function that would accomodate this standard dd/mm/yyyy. I would rather the later option.
function QDK_HTMLForm_OnSubmitHandlerCallback(theForm)
{
var now = new Date();
alert("Full date today: " + now);
var today = now.getTime();
alert("Today in time: " + today);
//var today = new Date(now.getDate(), now.getMonth()+1, now.getFullYear());
//alert("Today's Date Equals: " + today);
var datepick = document.forms[0].h_CalendarDate.value;
var selected = new Date(datepick);
var date = selected.getDate();
alert("Day: " + date);
var month = selected.getMonth();
alert("Month: " + month);
var year = selected.getYear();
alert("Year: " + year);
alert("Selected full date before: " + selected);
var selectedtime = selected.getTime();
alert("Selected date in time: " + selectedtime);