public class ISODateIO
extends java.lang.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(java.lang.String format)
Create a new scanner with a given format.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.regex.Pattern |
getPattern()
Get the current pattern used to parse timestamp.
|
java.util.Calendar |
parse(java.lang.String time)
Parse a string which should be in the scanner format.
|
void |
setFormat(java.lang.String format)
Set the format of this scanner.
|
java.lang.String |
toString(java.util.Calendar calendar)
Convert a calendar into a string according to the format of this object.
|
public ISODateIO()
throws java.text.ParseException
java.text.ParseExceptionpublic ISODateIO(java.lang.String format)
throws java.text.ParseException
format - format of the scanner.java.text.ParseException - if bad directives foundpublic java.util.regex.Pattern getPattern()
public void setFormat(java.lang.String format)
throws java.text.ParseException
format - new format of the scannerjava.text.ParseException - if an error is found in the new formatpublic java.util.Calendar parse(java.lang.String time)
time - timestamp in the scanner formatpublic java.lang.String toString(java.util.Calendar calendar)
calendar - the calendar to convert