Previous | Next | (P-PDF) JavaScript
Topic: compare to date
Conf: (P-PDF) JavaScript, Msg: 28590
From: Jub
Date: 10/16/2001 09:15 AM
lmp,
The values of these fields are strings.
You need to convert those strings into
date objects, evaluate those date objects
and then compare them.
For example...
var FirstDateField = this.getField("FirstDate");
var SecondDateField = this.getField("SecondDate");
var FirstString = FirstDateField.value;
var SecondString = SecondDateField.value;
if(FirstString && SecondString)
{ // check there are dates to work with...
var FirstDate = util.scand("mm/dd/yyyy",FirstString);
var SecondDate = util.scand("mm/dd/yyyy",SecondString);
var FirstMilliseconds = FirstDate.valueOf();
var SecondMilliseconds = SecondDate.valueOf();
if(FirstMilliseconds > SecondMilliseconds)
{
// do what you need to do
}
else
{
// do what you need to do
}
}
HTH,
Jub