public class DefaultTimestampFormat extends Object implements TimestampFormat
DateFormat
.Timestamp
,
Timestamps
,
DateFormat
ISO8601, ISO8601_BASIC_COMPLETE, ISO8601_BASIC_MINUTE, ISO8601_BASIC_SECOND, ISO8601_EXTENDED_COMPLETE, ISO8601_EXTENDED_MINUTE, ISO8601_EXTENDED_SECOND, XSD_DATETIME
Constructor and Description |
---|
DefaultTimestampFormat(DateFormat format)
Instantiates a timestamp format from a
DateFormat . |
DefaultTimestampFormat(String format)
Instantiates a timestamp format from a string-based date format
definition.
|
public DefaultTimestampFormat(String format)
SimpleDateFormat
.
Timestamps will be interpreted for UTC time zone.format
- the underlying date formatpublic DefaultTimestampFormat(DateFormat format)
Instantiates a timestamp format from a DateFormat
.
Note that the instantiation of a DateFormat
uses the local
time zone. You would need to set other time zones (e.g. UTC) explicitly by
calling DateFormat.setTimeZone(TimeZone)
.
format
- the underlying date format (e.g. "yyyy-MM-dd" for dates like "2000-01-13")public String format(Timestamp timestamp)
TimestampFormat
format
in interface TimestampFormat
timestamp
- the timestamp to be formattedpublic Timestamp parse(String string) throws TimestampParseException
TimestampFormat
parse
in interface TimestampFormat
string
- the timestamp to be parsedTimestampParseException
Copyright © Aimpulse Intelligent Systems GmbH
All rights reserved.