Package ucar.unidata.util
Class TimestampFormat
java.lang.Object
java.text.Format
ucar.unidata.util.TimestampFormat
- All Implemented Interfaces:
Serializable
,Cloneable
TODO: serious synchronization issues
- Version:
- $Revision: 1.11 $ $Date: 2006/05/05 19:19:38 $
- Author:
- $Author: jeffmc $
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
SimpleDateFormat pattern to describe ISO 8601 complete date plus hours, minutes, seconds and a decimal fraction of a second. -
Constructor Summary
ConstructorsConstructorDescription_more_TimestampFormat
(DateFormat delegate) _more_TimestampFormat
(DateFormat delegate, Calendar cal) _more_ -
Method Summary
Modifier and TypeMethodDescriptionstatic Timestamp
computeTimestamp
(String ddhhmm, Timestamp ref) Given a time string and a time reference, compute the time the string represents.static int
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.format
(Object ts, StringBuffer buf, FieldPosition pos) _more_format
(Timestamp ts, StringBuffer buf, FieldPosition fp) Formats an Timestamp to produce a string._more_static String
_more_static StringBuffer
isoformat
(Timestamp ts, StringBuffer buf, FieldPosition fp) Formats an Timestamp to produce a string.static void
_more__more_parse
(String source, ParsePosition status) Parses a string to produce a Timestamp.parseObject
(String source, ParsePosition status) _more_void
setDelegate
(DateFormat delegate) _more_static void
_more_static void
_more_static void
testHodOff
(String[] args) _more_Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Field Details
-
isoTimeFmtPattern
SimpleDateFormat pattern to describe ISO 8601 complete date plus hours, minutes, seconds and a decimal fraction of a second. http://www.w3.org/TR/NOTE-datetime- See Also:
-
-
Constructor Details
-
TimestampFormat
public TimestampFormat()_more_ -
TimestampFormat
_more_- Parameters:
delegate
-
-
TimestampFormat
_more_- Parameters:
delegate
-cal
-
-
-
Method Details
-
isoformat
Formats an Timestamp to produce a string. ISO 8601 Complete date plus hours, minutes, seconds and a decimal fraction of a second. http://www.w3.org/TR/NOTE-datetime- Parameters:
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.- Returns:
- the value passed in as toAppendTo
-
isoformat
_more_- Parameters:
ts
-- Returns:
- _more_
-
domOff
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. Ties favor earlier time. Assumes dom is in ref MONTH, the month prior, or the month after- Parameters:
dom
- int day of month, 1-31ref
- Calendar containing the reference time. exclusive access to ref should be guaranteed by the caller.- Returns:
- _more_
-
computeTimestamp
Given a time string and a time reference, compute the time the string represents. All times are UTC, Gregorian Calendar.- Parameters:
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 ddhhmm- Returns:
- Timestamp corresponding to ddhhmm.
- Throws:
ParseException
-
setDelegate
_more_- Parameters:
delegate
-
-
getDelegate
_more_- Returns:
- _more_
-
format
Formats an Timestamp to produce a string.- Parameters:
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.- Returns:
- the value passed in as toAppendTo
-
format
_more_ -
parse
Parses a string to produce a Timestamp.- Parameters:
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.
- Returns:
- _more_
-
parse
_more_- Parameters:
source
-- Returns:
- _more_
- Throws:
ParseException
-
parseObject
_more_- Specified by:
parseObject
in classFormat
- Parameters:
source
-status
-- Returns:
- _more_
-
test0
_more_- Parameters:
args
-
-
tdomOff
_more_- Parameters:
args
-
-
testHodOff
_more_- Parameters:
args
-
-
main
_more_- Parameters:
args
-
-