955130 wrote:If you want a Date type, why are you confusing the issue by specifying a string format? A Date has a large number of string representations. If you just want a Date, parse it as gimbal2 suggested.
Correct me if i am wrong ,if i just replace String, i will get output as string type . My requirement is output should be of Date Type not a string.
955130 wrote at 27.12.2012 22:20:
[...] My requirement is output should be of Date Type not a string.
955130 wrote at 28.12.2012 02:01:I want value of date_temp to be as February 02, 2013.<i>"February 02, 2013"</i> is the String representation of a <tt>Date</tt> according to the default <tt>Locale</tt> of your java installation.
Your line 8 does the conversion of the <tt>Date</tt> back to a <tt>String</tt>.
Date date_temp = (Date) dateFormat.parse(depDate);