Class TimeStringConverter


public class TimeStringConverter extends DateTimeStringConverter

A StringConverter implementation for Date values that represent time.

Note that using Date is not recommended in JDK versions where LocalTime is available, in which case LocalTimeStringConverter should be used.

Since:
JavaFX 2.1
  • Constructor Details

    • TimeStringConverter

      public TimeStringConverter()
      Creates a TimeStringConverter that uses a formatter/parser based on DateFormat.DEFAULT for the time style, and the user's Locale.
    • TimeStringConverter

      public TimeStringConverter(int timeStyle)
      Creates a TimeStringConverter that uses a formatter/parser based on the given time style, and the user's Locale.
      Parameters:
      timeStyle - the formatting style for times. For example, DateFormat.SHORT for "h:mm a" in the US locale.
      Since:
      JavaFX 8u40
    • TimeStringConverter

      public TimeStringConverter(Locale locale)
      Creates a TimeStringConverter that uses a formatter/parser based on DateFormat.DEFAULT for the time style, and the given Locale.
      Parameters:
      locale - the Locale that will be used by the formatter/parser. If null, the user's locale will be used.
    • TimeStringConverter

      public TimeStringConverter(Locale locale, int timeStyle)
      Creates a TimeStringConverter that uses a formatter/parser based on the given time style and Locale.
      Parameters:
      locale - the Locale that will be used by the formatter/parser. If null, the user's locale will be used.
      timeStyle - the formatting style for times. For example, DateFormat.SHORT for "h:mm a" in the US locale.
      Since:
      JavaFX 8u40
    • TimeStringConverter

      public TimeStringConverter(String pattern)
      Creates a TimeStringConverter that uses a formatter/parser based on the given pattern, and the user's Locale.
      Parameters:
      pattern - the pattern describing the time format. If null, DateFormat.DEFAULT will be used for the time style.
    • TimeStringConverter

      public TimeStringConverter(Locale locale, String pattern)
      Creates a TimeStringConverter that uses a formatter/parser based on the given pattern and Locale.
      Parameters:
      locale - the Locale that will be used by the formatter/parser. If null, the user's locale will be used.
      pattern - the pattern describing the time format. If null, DateFormat.DEFAULT will be used for the time style.
    • TimeStringConverter

      public TimeStringConverter(DateFormat dateFormat)
      Creates a TimeStringConverter that uses the given formatter/parser.
      Parameters:
      dateFormat - the formatter/parser that will be used by the toString() and fromString() methods. If null, a default formatter/parser will be used.