- java.lang.Object
-
- javafx.util.StringConverter<Date>
-
- javafx.util.converter.DateTimeStringConverter
-
- Direct Known Subclasses:
DateStringConverter,TimeStringConverter
public class DateTimeStringConverter extends StringConverter<Date>
StringConverterimplementation forDatevalues that represent a date and time.- Since:
- JavaFX 2.1
- See Also:
DateStringConverter,TimeStringConverter
-
-
Field Summary
Fields Modifier and Type Field Description protected DateFormatdateFormatDeprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.protected intdateStyleDeprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.protected LocalelocaleDeprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.protected StringpatternDeprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.protected inttimeStyleDeprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.
-
Constructor Summary
Constructors Constructor Description DateTimeStringConverter()DateTimeStringConverter(int dateStyle, int timeStyle)DateTimeStringConverter(String pattern)Create aStringConverterforDatevalues, using the specified pattern.DateTimeStringConverter(DateFormat dateFormat)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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DatefromString(String value)Converts the string provided into an object defined by the specific converter.protected DateFormatgetDateFormat()Deprecated, for removal: This API element is subject to removal in a future version.This method exposes internal implementation details and will be removed in a future version.StringtoString(Date value)Converts the object provided into its string form.
-
-
-
Field Detail
-
locale
@Deprecated(forRemoval=true, since="17") protected final Locale locale
Deprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.
-
pattern
@Deprecated(forRemoval=true, since="17") protected final String pattern
Deprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.
-
dateFormat
@Deprecated(forRemoval=true, since="17") protected final DateFormat dateFormat
Deprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.
-
dateStyle
@Deprecated(forRemoval=true, since="17") protected final int dateStyle
Deprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.- Since:
- JavaFX 8u40
-
timeStyle
@Deprecated(forRemoval=true, since="17") protected final int timeStyle
Deprecated, for removal: This API element is subject to removal in a future version.This field was exposed erroneously and will be removed in a future version.- 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.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 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.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 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.pattern- the pattern describing the date and time format.
-
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>- 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.
-
getDateFormat
@Deprecated(forRemoval=true, since="17") protected DateFormat getDateFormat()
Deprecated, for removal: This API element is subject to removal in a future version.This method exposes internal implementation details and will be removed in a future version.Return a
DateFormatinstance to use for formatting and parsing in thisStringConverter.- Returns:
- a
DateFormatinstance for formatting and parsing in thisStringConverter
-
-