You need to add the variables for hours, minutes, seconds and milliseconds to the code. A generalized version that will work with omitted time elements follows.
function CheckExpiration(LastYear, LastMonth, LastDate, LastHour, LastMin, LastSec, LastMS) {
// document level function to see if passed date less than today's date
// check that numbers are passed as parameters
if (isNaN(LastYear) ) LastYear = 1900;
if (isNaN(LastMonth) ) LastMonth = 1;
if (isNaN(LastDate) ) LastDate = 1;
if (isNaN(LastHour) ) LastHour = 0;
if (isNaN(LastMin) ) LastMin = 0;
if (isNaN(LastSec) ) LastSec= 0;
if (isNaN(LastMS) ) LastMS = 0;
LastMonth = LastMonth - 1; // adjust the passed month to the zero based month
// make the expiration date time object a numeric value
var myDate = new Date( Number(LastYear), Number(LastMonth), Number(LastDate), Number(LastHour), Number(LastMin), Number(LastSec), Number(LastMS) ).valueOf(); // convert passed expiration date time to a date time object value
// get the current date time's object as a numeric value
var today = new Date().valueOf();
// return logical value of the comparison of the passed expiration date value to today - if true document has expired
return (myDate < today);
}
// the following code has to be executed after the above function is defined
// edit following fields
var ExpireYear = 2008; // 2008
var ExpireMonth = 3; // March
var ExpireDate = 21; // 21st
var ExpireHour = 12; // noon
var ExpireMin = 0;
// the following code has to executed after the above function and variables are defined.
// test for expired document based on result of the passed time elements compared to the current date and time as returned by the CheckExpiration() function.
if (CheckExpiration(ExireYear, ExpireMonth, ExoireDate, ExpireHour, ExpireMin) ) {
this.closeDoc(1);
app.alert("This files has expired.",1,0,"Expired");
}