Class DateTimeStringConverter
- javafx.util.StringConverter<Date>
-
- javafx.util.converter.DateTimeStringConverter
Direct Known Subclasses:
public class DateTimeStringConverter extends StringConverter<Date>
StringConverter implementation for Date values that represent a date and time.
Since:
JavaFX 2.1
See Also:
-
Field Summary
Fields Modifier and Type Field and Description protected DateFormatdateFormatprotected intdateStyleprotected Localelocaleprotected Stringpatternprotected inttimeStyle
-
Constructor Summary
Constructors Constructor and Description DateTimeStringConverter()DateTimeStringConverter(DateFormat dateFormat)DateTimeStringConverter(int dateStyle, int timeStyle)DateTimeStringConverter(Locale locale)Create aStringConverterforDatevalues, using the specified locale andDateFormat.DEFAULTstyles for date and time.DateTimeStringConverter(Locale locale, int dateStyle, int timeStyle)Create aStringConverterforDatevalues, using specified locale andDateFormatstyles for date and time.DateTimeStringConverter(Locale locale, String pattern)Create aStringConverterforDatevalues, using the specified locale and pattern.DateTimeStringConverter(String pattern)Create aStringConverterforDatevalues, using the specified pattern.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description DatefromString(String value)Converts the string provided into an object defined by the specific converter.protected DateFormatgetDateFormat()Return aDateFormatinstance to use for formatting and parsing in thisStringConverter.StringtoString(Date value)Converts the object provided into its string form.
-
Field Detail
-
locale
protected final Locale locale
-
pattern
protected final String pattern
-
dateFormat
protected final DateFormat dateFormat
-
dateStyle
protected final int dateStyle
Since:
JavaFX 8u40
-
timeStyle
protected final int timeStyle
Since:
JavaFX 8u40
-
-
Constructor Detail
-
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.Since:
JavaFX 8u40
-
DateTimeStringConverter
public DateTimeStringConverter(Locale locale)
Create aStringConverterforDatevalues, using the specified locale andDateFormat.DEFAULTstyles for date and time.Parameters:
locale- the given locale.
-
DateTimeStringConverter
public DateTimeStringConverter(Locale locale, int dateStyle, int timeStyle)Create aStringConverterforDatevalues, using specified locale andDateFormatstyles for date and time.Parameters:
locale- the given locale.Since:
JavaFX 8u40
-
DateTimeStringConverter
public DateTimeStringConverter(String pattern)
Create aStringConverterforDatevalues, using the specified pattern.Parameters:
pattern- the pattern describing the date and time format.
-
DateTimeStringConverter
public DateTimeStringConverter(Locale locale, String pattern)Create aStringConverterforDatevalues, using the specified locale and pattern.Parameters:
locale- the given locale.
-
DateTimeStringConverter
public DateTimeStringConverter(DateFormat dateFormat)
Parameters:
dateFormat- theDateFormatto be used for formatting and parsing.
-
-
Method Detail
-
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>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>Returns:
a string representation of the object passed in.
-
getDateFormat
protected DateFormat getDateFormat()
Return a
DateFormatinstance to use for formatting and parsing in thisStringConverter.
-
© 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.