Here you can find the source of createDateFormatsForLocaleAndTimeZone(Locale locale, TimeZone timeZone)
static DateFormat[] createDateFormatsForLocaleAndTimeZone(Locale locale, TimeZone timeZone)
//package com.java2s; import java.text.DateFormat; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.TimeZone; public class Main { /**//from w ww . j a v a2 s . c o m * Build an array of DateFormats that are commonly used for this locale * and timezone. */ static DateFormat[] createDateFormatsForLocaleAndTimeZone(Locale locale, TimeZone timeZone) { List<DateFormat> formats = new ArrayList<DateFormat>(); addDateTimeFormatsToList(locale, timeZone, formats); addDateFormatsToList(locale, timeZone, formats); return formats.toArray(new DateFormat[formats.size()]); } static void addDateTimeFormatsToList(Locale locale, TimeZone timeZone, List<DateFormat> formats) { for (int dateStyle = DateFormat.FULL; dateStyle <= DateFormat.SHORT; dateStyle++) { for (int timeStyle = DateFormat.FULL; timeStyle <= DateFormat.SHORT; timeStyle++) { DateFormat df = DateFormat.getDateTimeInstance(dateStyle, timeStyle, locale); if (timeZone != null) { df.setTimeZone(timeZone); } formats.add(df); } } } static void addDateFormatsToList(Locale locale, TimeZone timeZone, List<DateFormat> formats) { for (int dateStyle = DateFormat.FULL; dateStyle <= DateFormat.SHORT; dateStyle++) { DateFormat df = DateFormat.getDateInstance(dateStyle, locale); df.setTimeZone(timeZone); formats.add(df); } } }