Class DateTimeFormatterUtil

java.lang.Object
org.keycloak.theme.DateTimeFormatterUtil

public class DateTimeFormatterUtil extends Object
Util class for localized date and time representation
Author:
Martin Bartos
  • Constructor Details

    • DateTimeFormatterUtil

      public DateTimeFormatterUtil()
  • Method Details

    • getDateTimeFromMillis

      public static String getDateTimeFromMillis(long millis)
    • getDateTimeFromMillis

      public static String getDateTimeFromMillis(long millis, String locale)
    • getDateTimeFromMillis

      public static String getDateTimeFromMillis(long millis, Locale locale)
    • getDateTimeFromMillis

      public static String getDateTimeFromMillis(long millis, DateFormat dateFormat)
      Get string representation of localized date and time
      Parameters:
      millis - number of milliseconds passed since January 1, 1970, 00:00:00 GMT
      dateFormat - format of date and time. See DateFormat
      Returns:
      string representation
    • getLocaleFromString

      public static Locale getLocaleFromString(String locale)
    • getLocaleFromString

      public static Locale getLocaleFromString(String locale, Locale defaultValue)
      Parse Locale from string
      Parameters:
      locale - required locale
      defaultValue - default value if the locale parameter is invalid
      Returns:
      Locale
    • getDefaultDateFormat

      public static DateFormat getDefaultDateFormat()
    • getDefaultDateFormat

      public static DateFormat getDefaultDateFormat(Locale locale)