File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes getting wrong value after converting a string into date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting wrong value after converting a string into date" Watch "getting wrong value after converting a string into date" New topic
Author

getting wrong value after converting a string into date

aman thind
Ranch Hand

Joined: Jun 29, 2007
Posts: 71
Here is my code:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
dateFormat.setLenient(true);
Date convertedDate=null;
convertedDate = dateFormat.parse(2008-08-25);

Date and year are coming correct but month is always showing Jan

Little help here please


Aman Thind
SCJP,SCWCD
JAVA utte mar JAVA,mit JAVA
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
I think you mean months and not minutes

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
aman thind
Ranch Hand

Joined: Jun 29, 2007
Posts: 71
Martin Vanyavchich wrote:I think you mean months and not minutes

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");


Isn't that be default months??
OOps thanks a lot
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting wrong value after converting a string into date
 
Similar Threads
Date format... please help
Best way to convert date from MM/dd/yyyy to yyyy-mm-dd ?
Convert String to Date format
SimpleDateFormat not returning expectec output?
Problem converting a String to java.util.Date