How to convert a string into date?
1 posts in topic
Flat View  Flat View

Posted By:   Ashok_Jekaa
Posted On:   Wednesday, September 26, 2001 11:53 PM

I want to convert a string into date object.

String = "17-SEP-2001"..
Can i convert into Date object?

Re: How to convert a string into date?

Posted By:   Luigi_Viggiano  
Posted On:   Thursday, September 27, 2001 01:25 AM

Hi, "sep" is wrong (use "set" instead). Try this code:

String dateString = "17-set-2001";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MMM-yyyy");
java.util.Date date = sdf.parse(dateString);
System.out.println("date = " + date);
About | Sitemap | Contact