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 ) ; }
Generates a DateTimeFormatter using a custom pattern with the default locale or a new one according to what language and country are provided as params .