Hi , I want to a convert String sValid = "05/11/2003" to a date format in mm/dd/yyyy only. When i am using the below mentioned code it is giving me week ate:time which i dont want . I only want in mm/dd/yyyy format. can Any one Help
You are parsing a String into a java.util.Date object, then printing out the java.util.Date object. I think what you want to do is use SimpleDateFormat to format() a String into your chosen form, then print out that String. And to head off the next question, check your pattern against the documentation. [ November 07, 2003: Message edited by: Joe Ess ]
Hi , Thanks Joe for ur valuable time. I do not want the output in String. I want the output in Date object only in mm/dd/yyyy. JAVA GURUS Is it possible to get a Date object only in mm/dd/yyyy format without Time.
JAVA GURUS Is it possible to get a Date object only in mm/dd/yyyy format without Time. I'd say that Joe is a Java guru. And his last advice is still important here - check the format pattern you're using against the documentation. Specifically, what do m, d, and y mean? There's a subtle flaw in your current pattern. Now that thing is, a Date will always have a time component to it. If you set up your pattern correctly to parse a date using only may, month, and year, then the time should compe out equal to 00:00:00. If you don't care about time, then just ignore the 00:00:00. If you don't want to see it, then don't print out your Date without using a formatter, as Joe suggested: