Package ch.tocco.nice2.types.api
Class DateTimeUtil
java.lang.Object
ch.tocco.nice2.types.api.DateTimeUtil
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.joda.time.DateTime
createDateTimeFromConstant
(String word, org.joda.time.DateTimeZone dateTimeZone) Creates a DateTime object that corresponds to the specified word, which may be 'today', 'tomorrow' or 'yesterday' as defined by those constants in this class.static org.joda.time.LocalDate
createLocalDateFromConstant
(String word, org.joda.time.DateTimeZone dateTimeZone) Creates a LocalDate object that corresponds to the specified word, which may be 'today', 'tomorrow' or 'yesterday' as defined by those constants in this class.
-
Field Details
-
TODAY
- See Also:
-
TOMORROW
- See Also:
-
YESTERDAY
- See Also:
-
NOW
- See Also:
-
START
- See Also:
-
-
Method Details
-
createLocalDateFromConstant
public static org.joda.time.LocalDate createLocalDateFromConstant(String word, org.joda.time.DateTimeZone dateTimeZone) Creates a LocalDate object that corresponds to the specified word, which may be 'today', 'tomorrow' or 'yesterday' as defined by those constants in this class.- Parameters:
word
- the special keyword for a date constant- Returns:
- a org.joda.time.LocalDate object, or
null
if the word is unknown
-
createDateTimeFromConstant
public static org.joda.time.DateTime createDateTimeFromConstant(String word, org.joda.time.DateTimeZone dateTimeZone) Creates a DateTime object that corresponds to the specified word, which may be 'today', 'tomorrow' or 'yesterday' as defined by those constants in this class. The identifier 'start' may be added (prefixed by a '_') to any of the above words to get a timestamp at the beginning (i.e. midnight) of the requested date in the provided timezone.- Parameters:
word
- the special keyword for a date constantdateTimeZone
- time zone to interpret the provided word in- Returns:
- a org.joda.time.DateTime object, or
null
if the word is unknown
-