Class DateTimeParser

java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.from_string.to_epoch.DateTimeParser
All Implemented Interfaces:
Function<String,org.joda.time.DateTime>

public class DateTimeParser extends Object implements Function<String,org.joda.time.DateTime>
This function will parse a String containing a formatted date time, yielding a DateTime object. If no arguments are provided, then the format is set to "yyyy-MM-dd HH:mm:ss.SSSZ". For details on formatting options, see @see DateTimeFormat
  • Constructor Details

    • DateTimeParser

      public DateTimeParser()
      Initialize the parser with the default pattern of
      yyyy-MM-dd HH:mm:ss.SSSZ
      .
    • DateTimeParser

      public DateTimeParser(String dateTimePattern)
      Initialize the parser with the given pattern. With this form, if any input fails to parse, or is null or empty, then an exception is thrown.
      Parameters:
      dateTimePattern - The pattern which represents the incoming format.
    • DateTimeParser

      public DateTimeParser(String dateTimePattern, String defaultTime)
      Initialize the parser with the given pattern and default value. In this form, if any input fails to parse, then exceptions are suppressed and the default is provided instead. At initialization, the default is parsed as a sanity check.
      Parameters:
      dateTimePattern - The pattern which represents the incoming format.
      defaultTime - An example of a formatted datetime string which is used as a default.
  • Method Details

    • apply

      public org.joda.time.DateTime apply(String formattedDateTime)
      Specified by:
      apply in interface Function<String,org.joda.time.DateTime>