EspressReport 6.6

quadbase.util
Class DateTimeFormat

java.lang.Object
  extended by quadbase.util.DateTimeFormat
All Implemented Interfaces:
IFormat

public class DateTimeFormat
extends java.lang.Object
implements IFormat

DateTimeFormat

This class is used to format date, time and timestamp type.

See Also:
LocaleDateTimeFormat

Field Summary
static short DMY
          date format dd/mm/yy
 boolean fixDigitLen
          display fixed number of digits for month and day, e.g.
 boolean hidedate
          Hide the day display (default false)
 boolean hidemonth
          Hide the month display (default false)
 boolean hideTimestampTime
          Hide the time display in Timestamp (default false)
 boolean hideyear
          Hide the year display (default false)
 boolean hour24
          true for 24 hour clock (default true)
 java.lang.String hourMinuteSep
          hour minute separator (default ":")
static short MDY
          date format mm/dd/yy
 java.lang.String minuteSecondSep
          minute second separator (default ":")
static short MONTH_INT
          month format 1-12
static short MONTH_LONG_STRING
          month format January-December
static short MONTH_SHORT_STRING
          month format Jan-Dec
static java.lang.String[] MonthString
          Take in user specified string array for displaying months, default to the full alphabetical months
 short monthSymbol
          month format, either MONTH_INT (default) or MONTH_SHORT_STRING or MONTH_LONG_STRING
 short nanoDecimal
          For timestamp, no.
 short orderSymbol
          date order, either MDY (default) or DMY or YMD
 java.lang.String separator1
          first separator string for date format (default "/")
 java.lang.String separator2
          second separator string for date format (default "/")
 boolean showMinute
          true to display minute (default true)
 boolean showSecond
          true to display second (default true)
 boolean timeBeforeDate
          For timestamp, put display time before date (default false)
 java.lang.String timeDateSep
          For timestamp, time date separator (default " ")
static short YEAR_1999
          year format 1999
static short YEAR_99
          year format 99
 short yearSymbol
          year format, either YEAR_1999 or YEAR_99 (default)
static short YMD
          date format yy/mm/dd
 
Fields inherited from interface quadbase.util.IFormat
DATETIME, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC
 
Constructor Summary
DateTimeFormat()
          Creates a new DateTimeFormat with default value
DateTimeFormat(boolean useTimestamp)
           
 
Method Summary
 java.lang.String format(java.lang.Object obj)
          Defines quadbase.util.IFormat Format the object if it is a instance of java.sql.Date, java.sql.Time or java.sql.Timestamp Otherwise, return its toString() value
 int getFormatType()
          Defines quadbase.util.IFormat Return the type of quadbase.util.IFormat
 java.lang.String output(java.util.Date date)
          Outputs the formatted date
 java.lang.String output(java.sql.Time time)
          Outputs the formatted time
 java.lang.String output(java.sql.Timestamp timestamp)
          Outputs the formatted timestamp
 void setDefault()
          Set all variables to default value.
 void setDefaultForTimestamp()
          Set all variables to default timestamp value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

YEAR_1999

public static final short YEAR_1999
year format 1999

See Also:
Constant Field Values

YEAR_99

public static final short YEAR_99
year format 99

See Also:
Constant Field Values

MONTH_INT

public static final short MONTH_INT
month format 1-12

See Also:
Constant Field Values

MONTH_SHORT_STRING

public static final short MONTH_SHORT_STRING
month format Jan-Dec

See Also:
Constant Field Values

MONTH_LONG_STRING

public static final short MONTH_LONG_STRING
month format January-December

See Also:
Constant Field Values

MDY

public static final short MDY
date format mm/dd/yy

See Also:
Constant Field Values

DMY

public static final short DMY
date format dd/mm/yy

See Also:
Constant Field Values

YMD

public static final short YMD
date format yy/mm/dd

See Also:
Constant Field Values

yearSymbol

public short yearSymbol
year format, either YEAR_1999 or YEAR_99 (default)


monthSymbol

public short monthSymbol
month format, either MONTH_INT (default) or MONTH_SHORT_STRING or MONTH_LONG_STRING


orderSymbol

public short orderSymbol
date order, either MDY (default) or DMY or YMD


separator1

public java.lang.String separator1
first separator string for date format (default "/")


separator2

public java.lang.String separator2
second separator string for date format (default "/")


hour24

public boolean hour24
true for 24 hour clock (default true)


showMinute

public boolean showMinute
true to display minute (default true)


showSecond

public boolean showSecond
true to display second (default true)


hourMinuteSep

public java.lang.String hourMinuteSep
hour minute separator (default ":")


minuteSecondSep

public java.lang.String minuteSecondSep
minute second separator (default ":")


nanoDecimal

public short nanoDecimal
For timestamp, no. of nano second digit display (default 0)


timeBeforeDate

public boolean timeBeforeDate
For timestamp, put display time before date (default false)


timeDateSep

public java.lang.String timeDateSep
For timestamp, time date separator (default " ")


hideyear

public boolean hideyear
Hide the year display (default false)


hidemonth

public boolean hidemonth
Hide the month display (default false)


hidedate

public boolean hidedate
Hide the day display (default false)


hideTimestampTime

public boolean hideTimestampTime
Hide the time display in Timestamp (default false)


fixDigitLen

public boolean fixDigitLen
display fixed number of digits for month and day, e.g. 1 will be displayed as 01 (default true)


MonthString

public static final java.lang.String[] MonthString
Take in user specified string array for displaying months, default to the full alphabetical months

Constructor Detail

DateTimeFormat

public DateTimeFormat()
Creates a new DateTimeFormat with default value


DateTimeFormat

public DateTimeFormat(boolean useTimestamp)
Method Detail

getFormatType

public int getFormatType()
Defines quadbase.util.IFormat Return the type of quadbase.util.IFormat

Specified by:
getFormatType in interface IFormat
Returns:
IFormat.DATETIME

format

public java.lang.String format(java.lang.Object obj)
Defines quadbase.util.IFormat Format the object if it is a instance of java.sql.Date, java.sql.Time or java.sql.Timestamp Otherwise, return its toString() value

Specified by:
format in interface IFormat
Parameters:
obj - The target object
Returns:
Formatted string

setDefault

public void setDefault()
Set all variables to default value.


setDefaultForTimestamp

public void setDefaultForTimestamp()
Set all variables to default timestamp value.


output

public java.lang.String output(java.util.Date date)
Outputs the formatted date

Parameters:
date - the date to be formatted
Returns:
formatted date

output

public java.lang.String output(java.sql.Time time)
Outputs the formatted time

Parameters:
time - the time to be formatted
Returns:
formatted time

output

public java.lang.String output(java.sql.Timestamp timestamp)
Outputs the formatted timestamp

Parameters:
timestamp - the timestamp to be formatted
Returns:
formatted timestamp

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

EspressReport 6.6