public class TimeAgoParser extends Object
Constructor and Description |
---|
TimeAgoParser(PatternsHolder patternsHolder)
Creates a helper to parse upload dates in the format '2 days ago'.
|
Modifier and Type | Method and Description |
---|---|
DateWrapper |
parse(String textualDate)
Parses a textual date in the format '2 days ago' into a Calendar representation which is then
wrapped in a
DateWrapper object. |
public TimeAgoParser(PatternsHolder patternsHolder)
Instantiate a new TimeAgoParser
every time you extract a new batch of items.
patternsHolder
- An object that holds the "time ago" patterns, special cases, and the
language word separator.public DateWrapper parse(String textualDate) throws ParsingException
DateWrapper
object.
Beginning with days ago, the date is considered as an approximation.
textualDate
- The original date as provided by the streaming serviceParsingException
- if the time unit could not be recognized