Here you can find the source of fromString(String dateStr, String dateFormat, Locale locale)
public static Date fromString(String dateStr, String dateFormat, Locale locale) throws java.text.ParseException
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static final String DATE_FORMAT = "yyyy-MM-dd G HH:mm:ss z"; public static Date fromString(String dateStr) throws java.text.ParseException { return fromString(dateStr, DATE_FORMAT); }/*ww w . j a v a2s . c o m*/ public static Date fromString(String dateStr, String dateFormat) throws java.text.ParseException { return fromString(dateStr, dateFormat, Locale.ENGLISH); } public static Date fromString(String dateStr, String dateFormat, Locale locale) throws java.text.ParseException { SimpleDateFormat format = new SimpleDateFormat(dateFormat, locale); return format.parse(dateStr); } }