Class DateFormatting

  • All Implemented Interfaces:
    Formatting, I18n

    public class DateFormatting
    extends java.lang.Object
    implements Formatting
    Provide some functions to get formatted date/time string.
    • Constructor Summary

      Constructors 
      Constructor Description
      DateFormatting()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String formatDate​(java.lang.Object obj, java.lang.String pattern, java.lang.String timeZone, java.lang.String language, java.lang.String region)  
      java.lang.String formatDate​(java.lang.Object obj, java.lang.String pattern, java.lang.String timeZone, java.util.Locale locale)
      Get the formatted string of specified time zone in specified pattern and specified Locale.
      java.lang.String formatDate​(java.lang.Object obj, java.lang.String pattern, java.util.Locale locale)
      Get the formatted string of default time zone in specified pattern and specified Locale.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DateFormatting

        public DateFormatting()
    • Method Detail

      • formatDate

        public java.lang.String formatDate​(java.lang.Object obj,
                                           java.lang.String pattern,
                                           java.util.Locale locale)
        Get the formatted string of default time zone in specified pattern and specified Locale.
        Parameters:
        obj - The object which represents date, it can be Date, Calendar, timestamp in long, or ISO string. For ISO string, please refer to https://www.w3.org/TR/NOTE-datetime.
        pattern - The format you want the date string show in. Currently VIP supports 12 formats, they are full, long, medium, short, fullDate, longDate, mediumDate, shortDate, fullTime, longTime, mediumTime, shortTime. The first four formats combine date and time together. For the real pattern each format represents
        locale - The locale for which the date format is desired.
        Returns:
        The formatted date/time string.
      • formatDate

        public java.lang.String formatDate​(java.lang.Object obj,
                                           java.lang.String pattern,
                                           java.lang.String timeZone,
                                           java.util.Locale locale)
        Get the formatted string of specified time zone in specified pattern and specified Locale.
        Parameters:
        obj - The object which represents date, it can be Date, Calendar, timestamp in long, or ISO string. For ISO string, please refer to https://www.w3.org/TR/NOTE-datetime.
        pattern - The format you want the date string show in. Currently VIP supports 12 formats, they are full, long, medium, short, fullDate, longDate, mediumDate, shortDate, fullTime, longTime, mediumTime, shortTime. The first four formats combine date and time together. For the real pattern each format represents
        timeZone - The ID for a TimeZone, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00".
        locale - The locale for which the date format is desired.
        Returns:
        The formatted date/time string.
      • formatDate

        public java.lang.String formatDate​(java.lang.Object obj,
                                           java.lang.String pattern,
                                           java.lang.String timeZone,
                                           java.lang.String language,
                                           java.lang.String region)