Class F_PlainTime

java.lang.Object
com.ssgllc.fish.f.plaintime.F_PlainTime

public class F_PlainTime extends Object
A time of day - no date, no zone - produced by PlainTimeBuilder.
  • Field Details

    • plainTime

      public LocalTime plainTime
      The underlying time, for handing to Java APIs that want a LocalTime.
  • Constructor Details

    • F_PlainTime

      public F_PlainTime(LocalTime time)
  • Method Details

    • format

      public String format(String pattern)
      The time formatted with a pattern. Only the hour and minute are used, so a pattern asking for seconds renders them as zero.
      Parameters:
      pattern - the format pattern
      Returns:
      the formatted time

      Groovy example:
      f().time.of("14:30").format("h:mm a")

      Returns:
      "2:30 PM"

      SpEL example:
      #f().time.of("14:30").format("h:mm a")
    • toIso

      public String toIso()
      The time as an ISO-8601 string, HH:mm (or HH:mm:ss when seconds are non-zero). This is also what the value serialises to.
      Returns:
      the time in ISO-8601

      Groovy example:
      f().time.of("2:30pm").toIso()

      Returns:
      "14:30"

      SpEL example:
      #f().time.of("2:30pm").toIso()