Class DateFormatter

java.lang.Object
com.tngtech.jgiven.format.DateFormatter
All Implemented Interfaces:
ArgumentFormatter<Date>

public class DateFormatter extends Object implements ArgumentFormatter<Date>
General formatter to format Date values.

This formatter simply delegates to a SimpleDateFormat.

Since:
0.15.0
  • Constructor Details

    • DateFormatter

      public DateFormatter()
  • Method Details

    • format

      public String format(Date date, String... args)
      A SimpleDateFormat pattern is expected as first argument.
      An optional second argument can be set to specify a locale as an ISO 639 language code.
      Specified by:
      format in interface ArgumentFormatter<Date>
      Parameters:
      date - the object to format
      args - optional arguments for the formatter to control the formatting.
      Returns:
      a formatted string