public class TimestampFormat
extends java.text.Format
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
isoTimeFmtPattern
SimpleDateFormat pattern to describe
ISO 8601 complete date plus hours, minutes, seconds
and a decimal fraction of a second.
|
Constructor and Description |
---|
TimestampFormat()
_more_
|
TimestampFormat(java.text.DateFormat delegate)
_more_
|
TimestampFormat(java.text.DateFormat delegate,
java.util.Calendar cal)
_more_
|
Modifier and Type | Method and Description |
---|---|
static Timestamp |
computeTimestamp(java.lang.String ddhhmm,
Timestamp ref)
Given a time string and a time reference, compute
the time the string represents.
|
static int |
domOff(int dom,
java.util.Calendar ref)
Return the number of days to add() to ref DAY_OF_MONTH
to get ref DAY_OF_MONTH = dom, such that the time in ref
changes the least.
|
java.lang.StringBuffer |
format(java.lang.Object ts,
java.lang.StringBuffer buf,
java.text.FieldPosition pos)
_more_
|
java.lang.StringBuffer |
format(Timestamp ts,
java.lang.StringBuffer buf,
java.text.FieldPosition fp)
Formats an Timestamp to produce a string.
|
java.text.DateFormat |
getDelegate()
_more_
|
static java.lang.String |
isoformat(Timestamp ts)
_more_
|
static java.lang.StringBuffer |
isoformat(Timestamp ts,
java.lang.StringBuffer buf,
java.text.FieldPosition fp)
Formats an Timestamp to produce a string.
|
static void |
main(java.lang.String[] args)
_more_
|
Timestamp |
parse(java.lang.String source)
_more_
|
Timestamp |
parse(java.lang.String source,
java.text.ParsePosition status)
Parses a string to produce a Timestamp.
|
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition status)
_more_
|
void |
setDelegate(java.text.DateFormat delegate)
_more_
|
static void |
tdomOff(java.lang.String[] args)
_more_
|
static void |
test0(java.lang.String[] args)
_more_
|
static void |
testHodOff(java.lang.String[] args)
_more_
|
public static final java.lang.String isoTimeFmtPattern
SimpleDateFormat
,
Constant Field Valuespublic TimestampFormat()
public TimestampFormat(java.text.DateFormat delegate)
delegate
- public TimestampFormat(java.text.DateFormat delegate, java.util.Calendar cal)
delegate
- cal
- public static java.lang.StringBuffer isoformat(Timestamp ts, java.lang.StringBuffer buf, java.text.FieldPosition fp)
ts
- Timestamp to formatbuf
- StringBuffer where the text is to be appendedfp
- On input: an alignment field, if desired.
On output: the offsets of the alignment field.public static java.lang.String isoformat(Timestamp ts)
ts
- public static int domOff(int dom, java.util.Calendar ref)
dom
- int day of month, 1-31ref
- Calendar containing the reference time.
exclusive access to ref should be guaranteed by the caller.public static Timestamp computeTimestamp(java.lang.String ddhhmm, Timestamp ref) throws java.text.ParseException
ddhhmm
- String timestamp of the form [DD]HHMM
where
DD is 2 digits day of month (01-31) (may be missing)
HH is 2 digits hour of day (00-23)
MM is 2 digits minute of hour (00-59)ref
- Timestamp of some moment near to
and generally after the time represented by ddhhmmjava.text.ParseException
public void setDelegate(java.text.DateFormat delegate)
delegate
- public java.text.DateFormat getDelegate()
public java.lang.StringBuffer format(Timestamp ts, java.lang.StringBuffer buf, java.text.FieldPosition fp)
ts
- Timestamp to formatbuf
- StringBuffer where the text is to be appendedfp
- On input: an alignment field, if desired.
On output: the offsets of the alignment field.public java.lang.StringBuffer format(java.lang.Object ts, java.lang.StringBuffer buf, java.text.FieldPosition pos)
format
in class java.text.Format
ts
- buf
- pos
- public Timestamp parse(java.lang.String source, java.text.ParsePosition status)
source
- String to parsestatus
- Input-Output parameter.
Before calling, set status.index to the offset you want to start parsing at in the source. After calling, status.index is the end of the text you parsed. If error occurs, index is unchanged.
When parsing, leading whitespace is discarded (with successful parse), while trailing whitespace is left as is.
public Timestamp parse(java.lang.String source) throws java.text.ParseException
source
- java.text.ParseException
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition status)
parseObject
in class java.text.Format
source
- status
- public static void test0(java.lang.String[] args)
args
- public static void tdomOff(java.lang.String[] args)
args
- public static void testHodOff(java.lang.String[] args)
args
- public static void main(java.lang.String[] args)
args
-