Class DateParser
java.lang.Object
org.apache.sling.servlets.post.impl.helper.DateParser
Takes a string representation of a time-date string and tries for parse it
using different formats.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParses the given source string and returns the respective calendar instance.Calendar[]Parses the given source strings and returns the respective calendar instances.voidRegisters a format string to the list of internally checked ones.
-
Constructor Details
-
DateParser
public DateParser()
-
-
Method Details
-
register
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
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
-
parse
Parses the given source strings and returns the respective calendar instances. If no format matches for any of the sources returnsnull.- Parameters:
sources- date time source strings- Returns:
- calendar representations of the source or
null
-