am having a string like this.
Thu Oct 07 11:31:50 IST 2010
I want to convert this into its exact date time format to store it in SQL.
Can't you do like below
String str = "Thu Oct 07 11:31:50 IST 2010"; SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd hh:mm:ss 'IST' yyyy"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd"); System.out.println(sdf2.format(sdf.parse(str)));