Date test comparision

Put your problem here if it does not fit any of the other categories.

Date test comparision

Postby slebed » Mon Aug 17, 2009 5:35 am

I'm trying to figure out how to compare the current date with a future date for the purpose of adding a timeout.

I've tried the following but its not working:



Date endTime;
{
endTime = new Date();
endTime.setMonth(11);
endTime.setYear(2009);
}

Date trialTime;
{
trialTime = new Date();
trialTime.getMonth();
trialTime.getYear();
}

boolean test = endTime.before(trialTime);

Changing the month in endTime doesn't alter the test value. It always returns as false

Any help is greatly appreciated.
slebed
Freshman
Freshman
 
Posts: 9
Joined: Sat Jul 11, 2009 10:22 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 23 guests