Hi.

In method parse() the date is parsed as follows:
SimpleDateFormat fullFormat = new SimpleDateFormat( "dd MM yyyy HH mm ss" );
if (timeZone != null)
        fullFormat.setTimeZone(timeZone);
return fullFormat.parse(day+" "+month+" "+year+" "+hours+" "+minutes+" "+seconds);

This is normally no problem, but when the variable "hours" is "12", SimpleDateFormat "misinterprets" this value and thinks it's 12 AM, but the user normally intendet 12 PM (using a 24h clock). This can be solved by using the following routine instead:
         
Calendar tempCalendar=Calendar.getInstance();
if (timeZone != null)
        tempCalendar.setTimeZone(timeZone);
tempCalendar.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day));
tempCalendar.set(Calendar.MONTH,Integer.parseInt(month)-1);
tempCalendar.set(Calendar.YEAR,Integer.parseInt(year));
tempCalendar.set(Calendar.HOUR_OF_DAY,Integer.parseInt(hours));
tempCalendar.set(Calendar.MINUTE,Integer.parseInt(minutes));
return tempCalendar.getTime();
}

Greets, Marcel Urbanek

Reply via email to