How to calculate a number of days between 2 date
Dear all,
I have the following script:
var Day1 = dateObj1.value.substring( 0, 2 );
var Month1 = dateObj1.value.substring( 3, 5 );
var Year1 = dateObj1.value.substring( 6, 10 );
var Dt1 = Year1 + Month1 + Day1;
var Day2 = dateObj2.value.substring( 0, 2 );
var Month2 = dateObj2.value.substring( 3, 5 );
var Year2 = dateObj2.value.substring( 6, 10 );
var Dt2 = Year2 + Month2 + Day2;
if( Dt1 > Dt2 || Dt1 == "" || Dt2 == "")
{
return true;
}
For example, if Dt1 value is 20050601 and Dt2 value is 20050523, how can i get the number of days?. besides that, i also want to check the condition if Dt1 value <=Dt2 + 60 prompt messgae"ok" otherwise prompt message "<= 60days of PPC date"
Any helps is highly appreciated.
Thanks in advance...
|