Class DateFormatter

java.lang.Object
org.eclipse.birt.core.format.DateFormatter
All Implemented Interfaces:
IFormatter

public class DateFormatter extends Object implements IFormatter
DateFormatter. Design for Class DateFormatter.This version is for open source, so we only apply the function which Java has provided. Beside these basic function, in this version, we also provide some new API for further implementation in the future
  • Field Details

    • DATETIME_UNFORMATTED

      public static final String DATETIME_UNFORMATTED
      property: date time unformatted
      See Also:
    • DATE_UNFORMATTED

      public static final String DATE_UNFORMATTED
      property: date unformatted
      See Also:
    • TIME_UNFORMATTED

      public static final String TIME_UNFORMATTED
      property: time unformatted
      See Also:
    • logger

      protected static Logger logger
      logger used to log syntax errors.
  • Constructor Details

    • DateFormatter

      public DateFormatter()
      Constructor method with no parameter
    • DateFormatter

      public DateFormatter(com.ibm.icu.util.TimeZone timeZone)
      Constructor
      Parameters:
      timeZone -
    • DateFormatter

      public DateFormatter(String pattern)
      Constructor method with String parameter
      Parameters:
      pattern -
    • DateFormatter

      public DateFormatter(com.ibm.icu.util.ULocale localeLoc)
      Constructor method with Locale parameters
      Parameters:
      localeLoc -
    • DateFormatter

      public DateFormatter(com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone)
      Constructor
      Parameters:
      localeLoc -
      timeZone -
    • DateFormatter

      public DateFormatter(String pattern, com.ibm.icu.util.ULocale localeLoc)
      Constructor method with two parameters, one is String type while the other is Locale type
      Parameters:
      pattern -
      localeLoc -
    • DateFormatter

      public DateFormatter(String pattern, com.ibm.icu.util.ULocale localeLoc, com.ibm.icu.util.TimeZone timeZone)
      Constructor
      Parameters:
      pattern - pattern of date
      localeLoc - local of date
      timeZone - time zone of date
  • Method Details

    • getPattern

      public String getPattern()
      get the string pattern
      Returns:
      Return the string pattern
    • applyPattern

      public void applyPattern(String formatString)
      Method to set the date/time format string
      Parameters:
      formatString -
    • format

      public String format(Date date)
      transfer the format string pattern from msdn to the string pattern which java can recognize
      Parameters:
      date - Date to recognize the format of Java
      Returns:
      Returns the analyst format of date
    • getFormatCode

      public String getFormatCode()
      Method to return format code according to format type and current locale
      Returns:
      Returns format code according to format type and current locale
    • getLocalizedFormatCode

      public String getLocalizedFormatCode()
      Method to return the format code according to format type and current locale
      Returns:
      Returns format code according to format type and current locale
    • getFormatter

      public com.ibm.icu.text.SimpleDateFormat getFormatter()
      Method to return the format code according to format type and current locale
      Returns:
      Returns format code according to format type and current locale
    • parse

      public Date parse(String date) throws ParseException
      Parses the input string into a formatted date type.
      Parameters:
      date - the input string to parse
      Returns:
      the formatted date
      Throws:
      ParseException - if the beginning of the specified string cannot be parsed.
    • formatValue

      public String formatValue(Object value)
      Description copied from interface: IFormatter
      format the value object into a string.
      Specified by:
      formatValue in interface IFormatter
      Returns: