Here "new Date("String")" is constructor is deprecated.if this is cause to produce this result,then explain me how it is?
Joined: Aug 05, 2005
Note that it is the Date constructor that is interpreting the String, not the DateFormat.format() call. The Javadoc says that when interpreting a string of decimal numbers
If the number is followed by a slash, it is regarded as a month ... unless a month has already been recognized, in which case it is regarded as a day of the month.
So the 16 is being recognised as the month. Presumably (although it doesn't say in the Javadoc), if the month is greater than 12, it subtracts 12 from it until it is less than 12 and adds 1 to the year for each subtraction.
Joined: Feb 28, 2007
For sure it is not due to the reason that Date(String arg) constructor has been deprecated.
It is because of the pattern you pass to the SimpleDateFormat(args) constructor. Pattern is really mind boggling for me!
Joined: Aug 25, 2006
what you need is the parse method. Example:
prints (depending on your locale) "raw": Mon Apr 16 00:00:00 CEST 2007 dateFormat: 16/04/2007
(edited, because forgot code tags) [ April 16, 2007: Message edited by: Burkhard Hassel ]