Package liquibase.util
Class NowAndTodayUtil
java.lang.Object
liquibase.util.NowAndTodayUtil
Handles 'NOW' and 'TODAY' for Date / Time type columns
-
Method Summary
Modifier and TypeMethodDescriptionstatic DatedoNowOrToday(String value, String colType) Determines value for "NOW" or "TODAY" prefixed value.static booleanisNowOrTodayFormat(String value) Checks if date starts with "NOW" or "TODAY".
-
Method Details
-
isNowOrTodayFormat
Checks if date starts with "NOW" or "TODAY".- Parameters:
value- value to test- Returns:
- true if value starts with "NOW" or "TODAY" (case insensitive), false otherwise.
-
doNowOrToday
Determines value for "NOW" or "TODAY" prefixed value. "NOW" format can simply be "NOW" (case insensitive), or "NOW" followed by a "+" or "=", then an integer, then a unit. "M" or "MINUTE" or "MINUTES", "H" or "HOUR" or "HOURS", "D" or "DAY" or "DAYS", "Y", "YEAR", or 'YEARS". "TODAY" format can be simply "TODAY" (case insensitive), or "TODAY" followed by a "+" or "-", then an integer, to calculate an offset from today.- Parameters:
value- value to convert to a datecolType- Column type (e.g. "timestamp", "time", "date", or "datetime")- Returns:
- calculated date, or null if is not a NOW or TODAY prefixed value.
- Throws:
DateParseException- if colType is not one of "timestamp", "time", "date", or "datetime"
-