Java Fails to Parse Date/Time String with Dateformat "MMM dd HH:mm:ss yyyy" for Russian Locale (Doc ID 1385493.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Java SE JDK and JRE - Version 5.0 and later
Information in this document applies to any platform.

Symptoms

Java fails to parse the date/time string with date format "MMM dd HH:mm:ss yyyy" for Russian Locale. Source code:

import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.TimeZone;

public class TestDateFormat {

     public static void main(String args[]) {

         SimpleDateFormat format = new SimpleDateFormat("MMM dd HH:mm:ss yyyy");
         format.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
         format.setLenient(false);
         try {
             format.parse("Oct 24 00:00:00 2011");
         } catch (ParseException e) {
             System.out.println(e);
         }
     }
}


When executed against Russian locale you see the below parse exception.

$ java -Duser.country=RU -Duser.language=ru TestDateFormat
java.text.ParseException: Unparseable date: "Oct 24 00:00:00 2011"


This exception does not happen with English locale.

Changes

Deployment in a Russian locale.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms