I am writing a web appliction which takes in a date in the format of 02/05/2004.
I need to format the date and then insert it into an Oracle DataBase which takes Dates in the format of 02/May/2004.
I am not sure of hwo to write the code but this is my effort:
String aDate = "02/04/2004";
String formattedDate = null;
DateFormat dateFormatter;
Locale lc = Locale.UK;
Date date = null;
dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT,lc);
try
{
date = dateFormatter.parse(aDate);
System.out.println(date.toString());
}
catch(ParseException e)
{
System.out.println("Date Exception "+e);
}
It return an exception Date Exception java.text.ParseException: Unparseable date: "02/04/2004"
Thansk for any help.
Tony