Interface DateMathParser

  • All Known Implementing Classes:
    JavaDateMathParser, JodaDateMathParser

    public interface DateMathParser
    An abstraction over date math parsing to allow different implementation for joda and java time.
    • Method Summary

      Modifier and Type Method Description
      default long parse​(java.lang.String text, java.util.function.LongSupplier now)
      Parse a date math expression without timzeone info and rounding down.
      long parse​(java.lang.String text, java.util.function.LongSupplier now, boolean roundUp, java.time.ZoneId tz)
      Parse text, that potentially contains date math into the milliseconds since the epoch Examples are 2014-11-18||-2y subtracts two years from the input date now/m rounds the current time to minute granularity Supported rounding units are y year M month w week (beginning on a monday) d day h/H hour m minute s second
      default long parse​(java.lang.String text, java.util.function.LongSupplier now, boolean roundUp, org.joda.time.DateTimeZone tz)
      Deprecated.
    • Method Detail

      • parse

        default long parse​(java.lang.String text,
                           java.util.function.LongSupplier now)
        Parse a date math expression without timzeone info and rounding down.
      • parse

        @Deprecated
        default long parse​(java.lang.String text,
                           java.util.function.LongSupplier now,
                           boolean roundUp,
                           org.joda.time.DateTimeZone tz)
        Deprecated.
      • parse

        long parse​(java.lang.String text,
                   java.util.function.LongSupplier now,
                   boolean roundUp,
                   java.time.ZoneId tz)
        Parse text, that potentially contains date math into the milliseconds since the epoch Examples are 2014-11-18||-2y subtracts two years from the input date now/m rounds the current time to minute granularity Supported rounding units are y year M month w week (beginning on a monday) d day h/H hour m minute s second
        Parameters:
        text - the input
        now - a supplier to retrieve the current date in milliseconds, if needed for additions
        roundUp - should the result be rounded up
        tz - an optional timezone that should be applied before returning the milliseconds since the epoch
        Returns:
        the parsed date in milliseconds since the epoch