Hi
I'm trying to convert a date written in a specific format into another different format using the DateFormat class.
I have this code but it's not working(it can't parse the given date and goes to the catch clause) and i dont know what s the reason, So if anyone has worked with that, can you tell me what s the problem
public static void main(
String[] args) {
String dateString = "Nov 4, 2003 8:14 PM";
DateFormat format = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
// Parse the date
try {
Date date = format.parse(dateString);
System.out.println("Original string: " + dateString);
System.out.println("Parsed date : " + date.toString());
}
catch(ParseException pe) {
System.out.println("ERROR: could not parse date in string \"" +
dateString + "\"");
}
}
thanks in advance
bye