| Author |
string to date conversion problem
|
mihir maniar
Ranch Hand
Joined: Sep 09, 2003
Posts: 88
|
|
|
i have a string in the format "01022006" which should get converted to date object and give me the date as 02-01-2006. i.e. 2nd Jan 2006. How can i achieve this?
|
 |
Arun Boraiah
Ranch Hand
Joined: Nov 28, 2001
Posts: 233
|
|
|
You can, explore the java.text.SimpleDateFormat class.
|
Sharing is learning
|
 |
mihir maniar
Ranch Hand
Joined: Sep 09, 2003
Posts: 88
|
|
when i try the following code it tells me unparseable date "01022006". could you pls help me the exact area where it is causing the problem and help me rectify it. thx. String strDate=new String("01052006"); Date d = DateFormat.getDateInstance().parse(strDate); out.println(d.toString());
|
 |
Arun Boraiah
Ranch Hand
Joined: Nov 28, 2001
Posts: 233
|
|
SimpleDateFormat dtFormat1 = new SimpleDateFormat("ddMMyyyy"); dt = dtFormat1.parse("02052006"); System.out.println("date is " + dt); [ May 02, 2006: Message edited by: Arun Boraiah ]
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: string to date conversion problem
|
|
|