@Test public void getDateFormatter() throws Exception { assertEquals(DateTimeUtils.getDateFormatter("HH:MM", "en", "us").getLocale(), Locale.US); assertEquals(DateTimeUtils.getDateFormatter("", "en", "us").getLocale(),Locale.US); }
public static DateTimeFormatter getDateFormatter(String format, String lang, String country) { if (StringUtils.isNotBlank(format)) { DateTimeFormatter dateFormat = DateTimeFormat.forPattern(format); if (StringUtils.isNotBlank(lang)) { return dateFormat.withLocale(DateTimeUtils.getLocaleByCountry(lang, country)); } return dateFormat; } return formatWithDefault(lang, country); }
DateTimeUtils { public static DateTimeFormatter getDateFormatter(String format, String lang, String country) { if (StringUtils.isNotBlank(format)) { DateTimeFormatter dateFormat = DateTimeFormat.forPattern(format); if (StringUtils.isNotBlank(lang)) { return dateFormat.withLocale(DateTimeUtils.getLocaleByCountry(lang, country)); } return dateFormat; } return formatWithDefault(lang, country); } }
DateTimeUtils { public static DateTimeFormatter getDateFormatter(String format, String lang, String country) { if (StringUtils.isNotBlank(format)) { DateTimeFormatter dateFormat = DateTimeFormat.forPattern(format); if (StringUtils.isNotBlank(lang)) { return dateFormat.withLocale(DateTimeUtils.getLocaleByCountry(lang, country)); } return dateFormat; } return formatWithDefault(lang, country); }  }
DateTimeUtils { public static DateTimeFormatter getDateFormatter(String format, String lang, String country) { if (StringUtils.isNotBlank(format)) { DateTimeFormatter dateFormat = DateTimeFormat.forPattern(format); if (StringUtils.isNotBlank(lang)) { return dateFormat.withLocale(DateTimeUtils.getLocaleByCountry(lang, country)); } return dateFormat; } return formatWithDefault(lang, country); }  static boolean isUnix(String locale); static boolean isMilliseconds(String locale); static boolean isDateValid(String date, Locale locale); static Locale getLocaleByCountry(String lang, String country); static DateTime getJodaOrJavaDate(final DateTimeFormatter dateFormatter, final String date); static DateTimeFormatter getDateFormatter(String format, String lang, String country); static DateTimeFormatter formatWithDefault(String lang, String country); }
DateTimeUtils { public static DateTimeFormatter getDateFormatter(String format, String lang, String country) { if (StringUtils.isNotBlank(format)) { DateTimeFormatter dateFormat = DateTimeFormat.forPattern(format); if (StringUtils.isNotBlank(lang)) { return dateFormat.withLocale(DateTimeUtils.getLocaleByCountry(lang, country)); } return dateFormat; } return formatWithDefault(lang, country); }  static boolean isUnix(String locale); static boolean isMilliseconds(String locale); static boolean isDateValid(String date, Locale locale); static Locale getLocaleByCountry(String lang, String country); static DateTime getJodaOrJavaDate(final DateTimeFormatter dateFormatter, final String date); static DateTimeFormatter getDateFormatter(String format, String lang, String country); static DateTimeFormatter formatWithDefault(String lang, String country);  }