Class DateStringConverter


public class DateStringConverter extends DateTimeStringConverter

A StringConverter implementation for Date values that represent dates.

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

Since:
JavaFX 2.1
  • Constructor Details

    • DateStringConverter

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

      public DateStringConverter(int dateStyle)
      Creates a DateStringConverter that uses a formatter/parser based on the given date style, and the user's Locale.
      Parameters:
      dateStyle - the formatting style for dates. For example, DateFormat.SHORT for "M/d/yy" in the US locale.
      Since:
      JavaFX 8u40
    • DateStringConverter

      public DateStringConverter(Locale locale)
      Creates a DateStringConverter that uses a formatter/parser based on DateFormat.DEFAULT for the date 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.
    • DateStringConverter

      public DateStringConverter(Locale locale, int dateStyle)
      Creates a DateStringConverter that uses a formatter/parser based on the given date style and Locale.
      Parameters:
      locale - the Locale that will be used by the formatter/parser. If null, the user's locale will be used.
      dateStyle - the formatting style for dates. For example, DateFormat.SHORT for "M/d/yy" in the US locale.
      Since:
      JavaFX 8u40
    • DateStringConverter

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

      public DateStringConverter(Locale locale, String pattern)
      Creates a DateStringConverter 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 date format. If null, DateFormat.DEFAULT will be used for the date style.
    • DateStringConverter

      public DateStringConverter(DateFormat dateFormat)
      Creates a DateStringConverter 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.