Class DateTimeStringConverter
- Direct Known Subclasses:
-
DateStringConverter,TimeStringConverter
public class DateTimeStringConverter extends StringConverter<Date>
StringConverter implementation for Date values that represent a date and time.
- Since:
- JavaFX 2.1
- See Also:
Constructor Summary
| Constructor | Description |
|---|---|
DateTimeStringConverter() |
|
DateTimeStringConverter |
|
DateTimeStringConverter |
Create a StringConverter for Date values, using the specified pattern. |
DateTimeStringConverter |
|
DateTimeStringConverter |
Create a StringConverter for Date values, using the specified locale and DateFormat.DEFAULT styles for date and time. |
DateTimeStringConverter |
Create a StringConverter for Date values, using specified locale and DateFormat styles for date and time. |
DateTimeStringConverter |
Create a StringConverter for Date values, using the specified locale and pattern. |
Method Summary
Constructor Details
DateTimeStringConverter
public DateTimeStringConverter()
DateTimeStringConverter
public DateTimeStringConverter(int dateStyle, int timeStyle)
- Parameters:
-
dateStyle- the given formatting style. For example,DateFormat.SHORTfor "M/d/yy" in the US locale. -
timeStyle- the given formatting style. For example,DateFormat.SHORTfor "h:mm a" in the US locale. - Since:
- JavaFX 8u40
DateTimeStringConverter
public DateTimeStringConverter(Locale locale)
Create a
StringConverter for Date values, using the specified locale and DateFormat.DEFAULT styles for date and time.- Parameters:
-
locale- the given locale.
DateTimeStringConverter
public DateTimeStringConverter(Locale locale, int dateStyle, int timeStyle)
Create a
StringConverter for Date values, using specified locale and DateFormat styles for date and time.- Parameters:
-
locale- the given locale. -
dateStyle- the given formatting style. For example,DateFormat.SHORTfor "M/d/yy" in the US locale. -
timeStyle- the given formatting style. For example,DateFormat.SHORTfor "h:mm a" in the US locale. - Since:
- JavaFX 8u40
DateTimeStringConverter
public DateTimeStringConverter(String pattern)
Create a
StringConverter for Date values, using the specified pattern.- Parameters:
-
pattern- the pattern describing the date and time format.
DateTimeStringConverter
public DateTimeStringConverter(Locale locale, String pattern)
Create a
StringConverter for Date values, using the specified locale and pattern.- Parameters:
-
locale- the given locale. -
pattern- the pattern describing the date and time format.
DateTimeStringConverter
public DateTimeStringConverter(DateFormat dateFormat)
- Parameters:
-
dateFormat- theDateFormatto be used for formatting and parsing.
Method Details
fromString
public Date fromString(String value)
Converts the string provided into an object defined by the specific converter. Format of the string and type of the resulting object is defined by the specific converter.
- Specified by:
-
fromStringin classStringConverter<Date> - Parameters:
-
value- theStringto convert - Returns:
- an object representation of the string passed in.
toString
public String toString(Date value)
Converts the object provided into its string form. Format of the returned string is defined by the specific converter.
- Specified by:
-
toStringin classStringConverter<Date> - Parameters:
-
value- the object of typeTto convert - Returns:
- a string representation of the object passed in
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.