I want to convert a string to Date in the format of "19/Apr/2010 17:46:57". Below is my code but this is not changing its giving in the format of "Mon Apr 19 17:54:39 GMT+05:30 2010"
A Date object doesn't have a changeable format. If you want to print the date object in a particular format, you will have to format it and print the resultant string -- formatting the date to a string, and parsing it back to a date, doesn't really do anything.
Doug,
after 6th line am getting the same format i needed but its in string only "19/Apr/2010 17:46:57".
While am inserting that string into database Oracle its giving an exception as "date format picture ends before converting entire input string".
Are you specifying a format when you insert into Oracle? Does that format on the Oracle insert match the String? It sounds like it might be missing a bit..