public class DateTimeFormat extends java.lang.Object implements IFormat
This class is used to format date, time and timestamp type.
LocaleDateTimeFormat
Modifier and Type | Field and Description |
---|---|
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
|
DATETIME, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC
Constructor and Description |
---|
DateTimeFormat()
Creates a new DateTimeFormat with default value
|
DateTimeFormat(boolean useTimestamp) |
Modifier and Type | Method and Description |
---|---|
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() |
public static final short YEAR_1999
public static final short YEAR_99
public static final short MONTH_INT
public static final short MONTH_SHORT_STRING
public static final short MONTH_LONG_STRING
public static final short MDY
public static final short DMY
public static final short YMD
public short yearSymbol
public short monthSymbol
public short orderSymbol
public java.lang.String separator1
public java.lang.String separator2
public boolean hour24
public boolean showMinute
public boolean showSecond
public java.lang.String hourMinuteSep
public java.lang.String minuteSecondSep
public short nanoDecimal
public boolean timeBeforeDate
public java.lang.String timeDateSep
public boolean hideyear
public boolean hidemonth
public boolean hidedate
public boolean hideTimestampTime
public boolean fixDigitLen
public static final java.lang.String[] MonthString
public DateTimeFormat()
public DateTimeFormat(boolean useTimestamp)
public int getFormatType()
getFormatType
in interface IFormat
public java.lang.String format(java.lang.Object obj)
public void setDefault()
public void setDefaultForTimestamp()
public java.lang.String output(java.util.Date date)
date
- the date to be formattedpublic java.lang.String output(java.sql.Time time)
time
- the time to be formattedpublic java.lang.String output(java.sql.Timestamp timestamp)
timestamp
- the timestamp to be formattedpublic java.lang.String toString()
toString
in class java.lang.Object