public class ISODateIO extends Object
Calendar
for convenience.
Format of the scanner can be composed of %? directive which define components
of the time. These directives are listed below. For example, the format
"%F %T", which is equivalent to "%Y-%m-%d %H:%M:%S" can parse the following
timestamp: "2010-12-09 03:45:39";
Constructor and Description |
---|
ISODateIO()
Create a scanner with default format "%K".
|
ISODateIO(String format)
Create a new scanner with a given format.
|
Modifier and Type | Method and Description |
---|---|
Pattern |
getPattern()
Get the current pattern used to parse timestamp.
|
Calendar |
parse(String time)
Parse a string which should be in the scanner format.
|
void |
setFormat(String format)
Set the format of this scanner.
|
String |
toString(Calendar calendar)
Convert a calendar into a string according to the format of this object.
|
public ISODateIO() throws ParseException
ParseException
public ISODateIO(String format) throws ParseException
format
- format of the scanner.ParseException
- if bad directives foundpublic Pattern getPattern()
public void setFormat(String format) throws ParseException
format
- new format of the scannerParseException
- if an error is found in the new formatpublic Calendar parse(String time)
time
- timestamp in the scanner formatCopyright © 2015. All rights reserved.