Class DateTimeFormatterUtil


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

      • DateTimeFormatterUtil

        public DateTimeFormatterUtil()
    • Method Detail

      • 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)