Package quadbase.util

Class LocaleDateTimeFormat

java.lang.Object
quadbase.util.LocaleDateTimeFormat
All Implemented Interfaces:
IFormat

public class LocaleDateTimeFormat extends Object implements IFormat
This class formats and parses date and/or time values in a locale-specific way. It cannot directly extand java.text.DateFormat because java.text.DateFormat is an abstract class. All formats implement quadbase.util.IFormat. Please use quadbase.util.IDataPointSet.setLabelFormat(int colIndex, IFormat format) to set the label format of a data column.
See Also:
  • Field Details

    • DATE

      public static int DATE
    • TIME

      public static int TIME
    • DATETIME

      public static int DATETIME
  • Method Details

    • setLocale

      public void setLocale(Locale locale)
      Sets the format locale
      Parameters:
      locale - The locale to become this format locale.
    • setTimeZone

      public void setTimeZone(TimeZone zone)
      Sets the time zone
      Parameters:
      zone - the given new time zone
    • getTimeZone

      public TimeZone getTimeZone()
      Gets the time zone
      Returns:
      the time zone associated with this format
    • getFormatType

      public int getFormatType()
      Define quadbase.util.IFormat. Return the type of quadbase.util.IFormat.
      Specified by:
      getFormatType in interface IFormat
      Returns:
      IFormat.LOCALEDATETIME
    • format

      public String format(Object obj)
      Define quadbase.util.IFormat. Format the object if it is an instance of java.sql.Date, java.sql.Time, java.sql.Timestamp. Otherwise, call the default toString() method. Argurment type java.util.Date is not supported here.
      Specified by:
      format in interface IFormat
      Parameters:
      obj - The target object
      Returns:
      Formatted string
    • getDateInstance

      public static LocaleDateTimeFormat getDateInstance()
      Create an instance of date format for the default locale and style.
      Returns:
      The new instance
    • getDateInstance

      public static LocaleDateTimeFormat getDateInstance(int style)
      Create an instance of date format for the default locale and the specified style.
      Parameters:
      style - The specifed style
      Returns:
      The new instance
      See Also:
    • getDateInstance

      public static LocaleDateTimeFormat getDateInstance(Locale locale)
      Create an instance of date format for the specified locale.
      Parameters:
      locale - The specifed locale
      Returns:
      The new instance
    • getDateInstance

      public static LocaleDateTimeFormat getDateInstance(int style, Locale locale)
      Create an instance of date format for the specified locale and style.
      Parameters:
      style - The specifed style
      locale - The specifed locale
      Returns:
      The new instance
      See Also:
    • getDateTimeInstance

      public static LocaleDateTimeFormat getDateTimeInstance()
      Create an instance of timestamp format for the default locale and styles.
      Returns:
      The new instance
    • getDateTimeInstance

      public static LocaleDateTimeFormat getDateTimeInstance(Locale locale)
      Create an instance of timestamp format for the specified locale.
      Parameters:
      locale - The specifed locale
      Returns:
      The new instance
    • getDateTimeInstance

      public static LocaleDateTimeFormat getDateTimeInstance(int dateStyle, int timeStyle)
      Create an instance of timestamp format for the specified styles.
      Parameters:
      dateStyle - The specifed date style
      timeStyle - The specified time style
      Returns:
      The new instance
      See Also:
    • getDateTimeInstance

      public static LocaleDateTimeFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
      Create an instance of timestamp format for the specified styles and locale.
      Parameters:
      dateStyle - The specifed date style
      timeStyle - The specified time style
      locale - The specifed locale
      Returns:
      The new instance
      See Also:
    • getTimeInstance

      public static LocaleDateTimeFormat getTimeInstance()
      Create an instance of time format for the default locale and style.
      Returns:
      The new instance
    • getTimeInstance

      public static LocaleDateTimeFormat getTimeInstance(int style)
      Create an instance of time format for the specifed locale.
      Parameters:
      style - The specifed style
      Returns:
      The new instance
      See Also:
    • getTimeInstance

      public static LocaleDateTimeFormat getTimeInstance(Locale locale)
      Create an instance of time format for the specifed locale.
      Parameters:
      locale - The specifed locale
      Returns:
      The new instance
      See Also:
    • getTimeInstance

      public static LocaleDateTimeFormat getTimeInstance(int style, Locale locale)
      Create an instance of time format for the specifed locale and style.
      Parameters:
      style - The specifed style
      locale - The specifed locale
      Returns:
      The new instance
      See Also:
    • getInstanceType

      public int getInstanceType()
      Get the type of instance.
      Returns:
      DATE, TIME or DATETIME
    • getDateStyle

      public int getDateStyle()
      Get the date style.
      Returns:
      The date style
      See Also:
    • getTimeStyle

      public int getTimeStyle()
      Get the time style.
      Returns:
      The time style
      See Also: