Class DateTimeFormatter


  • public class DateTimeFormatter
    extends Object
    Formatter of date values using adjusted SimpleDateFormat.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String format​(Date dateTime, com.ibm.icu.util.ULocale locale)
      Formats date and time with adjusted SimpleDateFormat with selected ICU locale (yy -> yyyy).
      static String format​(Date dateTime, String formatString)
      Formats date and time with adjusted SimpleDateFormat with default ICU locale (yy -> yyyy) and additional settings in selected V8 format string.
      static String getLongDatePattern​(com.ibm.icu.util.ULocale locale)
      Gets long date pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
      static com.ibm.icu.text.SimpleDateFormat getLongDateTimeFormat​(com.ibm.icu.util.ULocale locale)
      Gets long date and time ICU format with with selected ICU locale.
      static String getLongDateTimePattern​(com.ibm.icu.util.ULocale locale)
      Gets long date and time pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
      static String getShortDatePattern​(com.ibm.icu.util.ULocale locale)
      Gets short date pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
      static com.ibm.icu.text.SimpleDateFormat getShortDateTimeFormat​(com.ibm.icu.util.ULocale locale)
      Gets short date and time ICU format with with selected ICU locale.
      static String getShortDateTimePattern​(com.ibm.icu.util.ULocale locale)
      Gets short date and time pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
      static String getTimePattern​(com.ibm.icu.util.ULocale locale)
      Gets medium time pattern with with selected ICU locale.
    • Constructor Detail

      • DateTimeFormatter

        public DateTimeFormatter()
    • Method Detail

      • format

        public static String format​(Date dateTime,
                                    String formatString)
        Formats date and time with adjusted SimpleDateFormat with default ICU locale (yy -> yyyy) and additional settings in selected V8 format string.
        Parameters:
        dateTime - the date and time
        locale - the locale
        Returns:
        formatted date and time
      • format

        public static String format​(Date dateTime,
                                    com.ibm.icu.util.ULocale locale)
        Formats date and time with adjusted SimpleDateFormat with selected ICU locale (yy -> yyyy).
        Parameters:
        dateTime - the date and time
        locale - the locale
        Returns:
        formatted date and time
      • getLongDatePattern

        public static String getLongDatePattern​(com.ibm.icu.util.ULocale locale)
        Gets long date pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
        Parameters:
        locale - the locale
        Returns:
        long date pattern
      • getLongDateTimeFormat

        public static com.ibm.icu.text.SimpleDateFormat getLongDateTimeFormat​(com.ibm.icu.util.ULocale locale)
        Gets long date and time ICU format with with selected ICU locale.
        Parameters:
        locale - the locale
        Returns:
        the short date and time ICU format
      • getLongDateTimePattern

        public static String getLongDateTimePattern​(com.ibm.icu.util.ULocale locale)
        Gets long date and time pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
        Parameters:
        locale - the locale
        Returns:
        long date time pattern
      • getShortDatePattern

        public static String getShortDatePattern​(com.ibm.icu.util.ULocale locale)
        Gets short date pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
        Parameters:
        locale - the locale
        Returns:
        short date pattern
      • getShortDateTimeFormat

        public static com.ibm.icu.text.SimpleDateFormat getShortDateTimeFormat​(com.ibm.icu.util.ULocale locale)
        Gets short date and time ICU format with with selected ICU locale.
        Parameters:
        locale - the locale
        Returns:
        the short date and time ICU format
      • getShortDateTimePattern

        public static String getShortDateTimePattern​(com.ibm.icu.util.ULocale locale)
        Gets short date and time pattern with with selected ICU locale and transform 'yy' to 'yyyy'.
        Parameters:
        locale - the locale
        Returns:
        short date time pattern
      • getTimePattern

        public static String getTimePattern​(com.ibm.icu.util.ULocale locale)
        Gets medium time pattern with with selected ICU locale.
        Parameters:
        locale - the locale
        Returns:
        medium time pattern