Problem is you are comparing two strings, not two dates. Strings should be used to display the dates, not for date "arithmetic".
Convert id to a Date or Calendar (depending on the type of cx), and then use the before/after/equals methods of those classes to do the comparison. At 06:14 PM 12/3/01 +0000, Peter Palombi wrote: >hi all, > >i have a troble with a compare two date. >i have made this code > >cx.setTime(sdf1.parse(datains)); >String DataV = sdf2.format(cx.getTime()); >// to display the same format DataV and id >if (DataV.compareTo(id) > 0){ >} > >but itn\'t work correctly with this code i compare the >first two caratcters >for example >DataV = 01/12/2001 >id = 30/11/2001 > >the compare say that id > DataV but itsn\'t right! > >I don\'t know where is the error > >thanks for the help >Peter > > > > >----------------------------------------------------- >This mail sent through IMP: http://web.horde.org/imp/ > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com