|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springmodules.validation.util.date.DefaultDateParser
public class DefaultDateParser
DefaultDateParser parses many date formats to a string.
The supported date formats are:
Date formats can be added using DefaultDateParser#register(String, String).
These modifiers are supported:
Modifiers can be added using DefaultDateParser#register(String, DateModifier).
Modifiers can be combined and are parsed from left to right, for example:
2005-04-09 23:30:00>M+10d+8H
results in 2005-05-11 08:00:00
.
Nested Class Summary | |
---|---|
static interface |
DefaultDateParser.DateModifier
|
Constructor Summary | |
---|---|
DefaultDateParser()
|
Method Summary | |
---|---|
static DefaultDateParser |
getInstance()
|
Date |
parse(String str)
|
void |
register(String regexp,
DefaultDateParser.DateModifier dateParser)
Register your own date parser for a given regular expression. |
void |
register(String regexp,
String format)
Register a date format for a given regular expression. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultDateParser()
Method Detail |
---|
public static DefaultDateParser getInstance()
public Date parse(String str) throws DateParseException
parse
in interface DateParser
DateParseException
public void register(String regexp, String format)
Register a date format for a given regular expression.
regexp
- the regular expressionformat
- the date formatpublic void register(String regexp, DefaultDateParser.DateModifier dateParser)
Register your own date parser for a given regular expression.
regexp
- the regular expressiondateParser
- the date parser
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |