wood burning stoves 2.0*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Date comparision" Watch "Date comparision" New topic
Author

Date comparision

Lalit Vora
Ranch Hand

Joined: Jun 22, 2006
Posts: 37
Hi,

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
Lalit
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 }


Merrill
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
 
Similar Threads
How to get System Date and time
how to get system date and format it
How to get System Date and time
save entity with SYSDATE
how to get system date and format it