jQuery in Action, 3rd edition
The moose likes Struts and the fly likes Date comparision Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Date comparision" Watch "Date comparision" New topic

Date comparision

Lalit Vora
Ranch Hand

Joined: Jun 22, 2006
Posts: 37

can someone guide me please how to compare date i.e user inputed date with system date.

I have user inputted date in mm/dd/yyyy formate and i have default date as systemdate-1. Both i have using simpledate format.
I want to compare that user input date should not be greater than systemdate -1 I have system-1 date generated also. I dont know how to compare them. Please some one can help me with that.

Thank you very much
Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
You can do this using custom validator. My following posting might help you.

Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Once you have converted the input date to a java.util.Date, you can then use the "before" or "after" methods of that class to compare it with the system date:

if (inputDate.after(systemdate-1) { // do something }

Consultant, Sima Solutions
Lalit Vora
Ranch Hand

Joined: Jun 22, 2006
Posts: 37
Hi Merrill

Thanks alot its working now
I agree. Here's the link: http://aspose.com/file-tools
subject: Date comparision
It's not a secret anymore!