|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.datetime.formatters.DefaultFormatter
Default formatter used for getting and setting date/time information to and from strings.
For setting date and time, default formatter parses input String against
specified template. It extracts parts of input string upon patterns
and then each part is converted to a number for a date/time information.
It doesn't ignore any non-number charater. If conversion fails,
null
is returned. Translations from String are done by Java.
Getting date time is also user firendly. Specified template may not only contains patterns but also any text. To remove errors in decoding when text may be reckognized as one of patterns, template text may be quoted with the ' sign. Double ' quote in the text will be decoded as single quote.
Bellow is the list of the patterns that may be used in templates. This list enhances ISO 8601 standard. Patterns notted with + sign are used for settings, all patterns are used for gettings.
Constructor Summary | |
DefaultFormatter()
|
Method Summary | |
java.lang.String |
get(JDateTime jdt,
java.lang.String frmt)
Returns date as String in given format. |
DateTimeStamp |
set(java.lang.String s,
java.lang.String t)
Sets time from the string using template. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultFormatter()
Method Detail |
public java.lang.String get(JDateTime jdt, java.lang.String frmt)
get
in interface JdtFormatter
jdt
- JDateTime instancefrmt
- format
public DateTimeStamp set(java.lang.String s, java.lang.String t)
set
in interface JdtFormatter
s
- String that contains timet
- template
null
if error during conversion
occured
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |