public class DateTimeStringConverter
extends <any>
StringConverter
implementation for Date
values that
represent a date and time.
DateStringConverter
,
TimeStringConverter
Modifier and Type | Field and Description |
---|---|
protected java.text.DateFormat |
dateFormat |
protected int |
dateStyle |
protected java.util.Locale |
locale |
protected java.lang.String |
pattern |
protected int |
timeStyle |
Constructor and Description |
---|
DateTimeStringConverter()
Create a
StringConverter for Date values, using
DateFormat.DEFAULT styles for date and time. |
DateTimeStringConverter(java.text.DateFormat dateFormat)
Create a
StringConverter for Date values, using the
specified DateFormat formatter. |
DateTimeStringConverter(int dateStyle,
int timeStyle)
Create a
StringConverter for Date values, using specified
DateFormat styles for date and time. |
DateTimeStringConverter(java.util.Locale locale)
Create a
StringConverter for Date values, using the
specified locale and DateFormat.DEFAULT styles for date and time. |
DateTimeStringConverter(java.util.Locale locale,
int dateStyle,
int timeStyle)
Create a
StringConverter for Date values, using specified
locale and DateFormat styles for date and time. |
DateTimeStringConverter(java.util.Locale locale,
java.lang.String pattern)
Create a
StringConverter for Date values, using the
specified locale and pattern. |
DateTimeStringConverter(java.util.Locale locale,
java.lang.String pattern,
java.text.DateFormat dateFormat,
int dateStyle,
int timeStyle) |
DateTimeStringConverter(java.lang.String pattern)
Create a
StringConverter for Date values, using the
specified pattern. |
Modifier and Type | Method and Description |
---|---|
java.util.Date |
fromString(java.lang.String value) |
protected java.text.DateFormat |
getDateFormat()
Return a
DateFormat instance to use for formatting
and parsing in this StringConverter . |
java.lang.String |
toString(java.util.Date value) |
protected final java.util.Locale locale
protected final java.lang.String pattern
protected final java.text.DateFormat dateFormat
protected final int dateStyle
protected final int timeStyle
public DateTimeStringConverter()
StringConverter
for Date
values, using
DateFormat.DEFAULT
styles for date and time.public DateTimeStringConverter(int dateStyle, int timeStyle)
StringConverter
for Date
values, using specified
DateFormat
styles for date and time.dateStyle
- the given formatting style. For example,
DateFormat.SHORT
for "M/d/yy" in the US locale.timeStyle
- the given formatting style. For example,
DateFormat.SHORT
for "h:mm a" in the US locale.public DateTimeStringConverter(java.util.Locale locale)
StringConverter
for Date
values, using the
specified locale and DateFormat.DEFAULT
styles for date and time.locale
- the given locale.public DateTimeStringConverter(java.util.Locale locale, int dateStyle, int timeStyle)
StringConverter
for Date
values, using specified
locale and DateFormat
styles for date and time.locale
- the given locale.dateStyle
- the given formatting style. For example,
DateFormat.SHORT
for "M/d/yy" in the US locale.timeStyle
- the given formatting style. For example,
DateFormat.SHORT
for "h:mm a" in the US locale.public DateTimeStringConverter(java.lang.String pattern)
StringConverter
for Date
values, using the
specified pattern.pattern
- the pattern describing the date and time format.public DateTimeStringConverter(java.util.Locale locale, java.lang.String pattern)
StringConverter
for Date
values, using the
specified locale and pattern.locale
- the given locale.pattern
- the pattern describing the date and time format.public DateTimeStringConverter(java.text.DateFormat dateFormat)
StringConverter
for Date
values, using the
specified DateFormat
formatter.dateFormat
- the DateFormat
to be used for formatting and
parsing.DateTimeStringConverter(java.util.Locale locale, java.lang.String pattern, java.text.DateFormat dateFormat, int dateStyle, int timeStyle)
public java.util.Date fromString(java.lang.String value)
public java.lang.String toString(java.util.Date value)
protected java.text.DateFormat getDateFormat()
Return a DateFormat
instance to use for formatting
and parsing in this StringConverter
.
DateFormat
instance for formatting and parsing in this
StringConverter