File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes date format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "date format" Watch "date format" New topic

date format

Rajendra Nath

Joined: Nov 09, 2005
Posts: 27
hi all,

SimpleDateFormat dateformat=new SimpleDateFormat("MM-dd-yyyy");
System.out.println("Formated date:"+dateformat.format(dd)); String parsedate=dateformat.format(dd);

which prints this output
Formated date:02-02-2007

i am also using the date picker in a jsp, which prints the date as 2-2-2007.
there is a problem with these date formats. date picker gives the date as 2-2-2007, but the java code gives the date prepending with 0.
can you please help me. as there is a problem with executing the sql query.
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

Please do not post the same question more than once. It causes confusion and duplication of effort as the community tries to help everyone.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: date format
It's not a secret anymore!