Package quadbase.util
Class DateTimeFormat
java.lang.Object
quadbase.util.DateTimeFormat
- All Implemented Interfaces:
IFormat
DateTimeFormat
This class is used to format date, time and timestamp type.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortdate format dd/mm/yybooleandisplay fixed number of digits for month and day, e.g.booleanHide the day display (default false)booleanHide the month display (default false)booleanHide the time display in Timestamp (default false)booleanHide the year display (default false)booleantrue for 24 hour clock (default true)hour minute separator (default ":")static final shortdate format mm/dd/yyminute second separator (default ":")static final shortmonth format 1-12static final shortmonth format January-Decemberstatic final shortmonth format Jan-Decstatic final String[]Take in user specified string array for displaying months, default to the full alphabetical monthsshortmonth format, either MONTH_INT (default) or MONTH_SHORT_STRING or MONTH_LONG_STRINGshortFor timestamp, no.shortdate order, either MDY (default) or DMY or YMDfirst separator string for date format (default "/")second separator string for date format (default "/")booleantrue to display minute (default true)booleantrue to display second (default true)booleanFor timestamp, put display time before date (default false)For timestamp, time date separator (default " ")static final shortyear format 1999static final shortyear format 99shortyear format, either YEAR_1999 or YEAR_99 (default)static final shortdate format yy/mm/ddFields inherited from interface quadbase.util.IFormat
DATETIME, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new DateTimeFormat with default valueDateTimeFormat(boolean useTimestamp) -
Method Summary
Modifier and TypeMethodDescriptionDefines 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() valueintDefines quadbase.util.IFormat Return the type of quadbase.util.IFormatOutputs the formatted timeOutputs the formatted timestampOutputs the formatted datevoidSet all variables to default value.voidSet all variables to default timestamp value.toString()
-
Field Details
-
YEAR_1999
public static final short YEAR_1999year format 1999- See Also:
-
YEAR_99
public static final short YEAR_99year format 99- See Also:
-
MONTH_INT
public static final short MONTH_INTmonth format 1-12- See Also:
-
MONTH_SHORT_STRING
public static final short MONTH_SHORT_STRINGmonth format Jan-Dec- See Also:
-
MONTH_LONG_STRING
public static final short MONTH_LONG_STRINGmonth format January-December- See Also:
-
MDY
public static final short MDYdate format mm/dd/yy- See Also:
-
DMY
public static final short DMYdate format dd/mm/yy- See Also:
-
YMD
public static final short YMDdate format yy/mm/dd- See Also:
-
yearSymbol
public short yearSymbolyear format, either YEAR_1999 or YEAR_99 (default) -
monthSymbol
public short monthSymbolmonth format, either MONTH_INT (default) or MONTH_SHORT_STRING or MONTH_LONG_STRING -
orderSymbol
public short orderSymboldate order, either MDY (default) or DMY or YMD -
separator1
first separator string for date format (default "/") -
separator2
second separator string for date format (default "/") -
hour24
public boolean hour24true for 24 hour clock (default true) -
showMinute
public boolean showMinutetrue to display minute (default true) -
showSecond
public boolean showSecondtrue to display second (default true) -
hourMinuteSep
hour minute separator (default ":") -
minuteSecondSep
minute second separator (default ":") -
nanoDecimal
public short nanoDecimalFor timestamp, no. of nano second digit display (default 0) -
timeBeforeDate
public boolean timeBeforeDateFor timestamp, put display time before date (default false) -
timeDateSep
For timestamp, time date separator (default " ") -
hideyear
public boolean hideyearHide the year display (default false) -
hidemonth
public boolean hidemonthHide the month display (default false) -
hidedate
public boolean hidedateHide the day display (default false) -
hideTimestampTime
public boolean hideTimestampTimeHide the time display in Timestamp (default false) -
fixDigitLen
public boolean fixDigitLendisplay fixed number of digits for month and day, e.g. 1 will be displayed as 01 (default true) -
MonthString
Take in user specified string array for displaying months, default to the full alphabetical months
-
-
Constructor Details
-
DateTimeFormat
public DateTimeFormat()Creates a new DateTimeFormat with default value -
DateTimeFormat
public DateTimeFormat(boolean useTimestamp)
-
-
Method Details
-
getFormatType
public int getFormatType()Defines quadbase.util.IFormat Return the type of quadbase.util.IFormat- Specified by:
getFormatTypein interfaceIFormat- Returns:
- IFormat.DATETIME
-
format
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 -
setDefault
public void setDefault()Set all variables to default value. -
setDefaultForTimestamp
public void setDefaultForTimestamp()Set all variables to default timestamp value. -
output
Outputs the formatted date- Parameters:
date- the date to be formatted- Returns:
- formatted date
-
output
Outputs the formatted time- Parameters:
time- the time to be formatted- Returns:
- formatted time
-
output
Outputs the formatted timestamp- Parameters:
timestamp- the timestamp to be formatted- Returns:
- formatted timestamp
-
toString
-