aspose file tools*
The moose likes Beginning Java and the fly likes date format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "date format" Watch "date format" New topic
Author

date format

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
Date today = new Date();
SimpleDateFormat df = new SimpleDateFormat("MM/DD/yyyy");
System.out.println("today is " + df.format(today));

I got

today is 04/98/2008

instead of

today is 04/07/2008


what is wrong ??
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3682
    
  16
From the SimpleDateFormat javadoc
D Day in year Number
d Day in month Number


Joanne
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

then it should be like that.



These following pattern letters are defined in Java Docs (characters from 'A' to 'Z' and from 'a' to 'z' are reserved to do specific presentation).


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 375
thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: date format