Class DateParser
- java.lang.Object
-
- org.apache.sling.servlets.post.impl.helper.DateParser
-
public class DateParser extends Object
Takes a string representation of a time-date string and tries for parse it using different formats.
-
-
Constructor Summary
Constructors Constructor Description DateParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Calendar
parse(String source)
Parses the given source string and returns the respective calendar instance.Calendar[]
parse(String[] sources)
Parses the given source strings and returns the respective calendar instances.void
register(String format)
Registers a format string to the list of internally checked ones.
-
-
-
Method Detail
-
register
public void register(String format)
Registers a format string to the list of internally checked ones. Uses theSimpleDateFormat
.- Parameters:
format
- format as inSimpleDateFormat
- Throws:
IllegalArgumentException
- if the format is not valid.
-
parse
public Calendar parse(String source)
Parses the given source string and returns the respective calendar instance. If no format matches returnsnull
.- Parameters:
source
- date time source string- Returns:
- calendar representation of the source or
null
-
-