TimeStringConverter (JavaFX 28)
Description: declaration: module: javafx.base, package: javafx.util.converter, class: TimeStringConverter

# Class TimeStringConverter

java.lang.Object
javafx.util.StringConverter<Date>
javafx.util.converter.DateTimeStringConverter
javafx.util.converter.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 Summary

  Constructors
  Constructor
  Description
  `TimeStringConverter()`
  Creates a `TimeStringConverter` that uses a formatter/parser based on `DateFormat.DEFAULT` for the time style, and the user's `Locale`.
  `TimeStringConverter(int timeStyle)`
  Creates a `TimeStringConverter` that uses a formatter/parser based on the given time style, and the user's `Locale`.
  `TimeStringConverter(String pattern)`
  Creates a `TimeStringConverter` that uses a formatter/parser based on the given pattern, and the user's `Locale`.
  `TimeStringConverter(DateFormat dateFormat)`
  Creates a `TimeStringConverter` that uses the given formatter/parser.
  `TimeStringConverter(Locale locale)`
  Creates a `TimeStringConverter` that uses a formatter/parser based on `DateFormat.DEFAULT` for the time style, and the given `Locale`.
  `TimeStringConverter(Locale locale, int timeStyle)`
  Creates a `TimeStringConverter` that uses a formatter/parser based on the given time style and `Locale`.
  `TimeStringConverter(Locale locale, String pattern)`
  Creates a `TimeStringConverter` that uses a formatter/parser based on the given pattern and `Locale`.

- ## Method Summary

  ### Methods declared in class DateTimeStringConverter

  `fromString, toString`

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.