Class DateFormatter

java.lang.Object
ca.phon.session.format.DateFormatter
All Implemented Interfaces:
Formatter<LocalDate>

@FormatterType(java.time.LocalDate.class) public class DateFormatter extends Object implements Formatter<LocalDate>
  • Field Details

  • Constructor Details

    • DateFormatter

      public DateFormatter()
  • Method Details

    • createFormatter

      public static DateTimeFormatter createFormatter()
      Create a date formatter for LocalDateTime objects.
      Returns:
      formatter
    • dateTimeToString

      public static String dateTimeToString(LocalDate dateTime)
      Convert
      invalid @link
      DateTime
      objects to string
      Parameters:
      dateTime -
      Returns:
      text
    • dateTimeToString

      public static String dateTimeToString(LocalDateTime dateTime)
      Convert
      invalid @link
      DateTime
      objects to string
      Parameters:
      dateTime -
      Returns:
      text
    • stringToDateTime

      public static LocalDate stringToDateTime(String text)
      Convert a string to a
      invalid @link
      DateTime
      object
      Parameters:
      text -
      Returns:
      dateTime
      Throws:
      IllegalArgumentException
    • format

      public String format(LocalDate obj)
      Description copied from interface: Formatter
      Convert the given object into a formatted String.
      Specified by:
      format in interface Formatter<LocalDate>
      Returns:
      formatted string
    • parse

      public LocalDate parse(String text) throws ParseException
      Description copied from interface: Formatter
      Parse the given string into a new object instance
      Specified by:
      parse in interface Formatter<LocalDate>
      Returns:
      parsed object
      Throws:
      ParseException - if there was a problem parsing the given text