java.util.Date and vice versa.
This class supports multiple date formats. For example, you can define conversions from dates represented by different Strings such as "2001/05/02 and Dec/2013".
The reverse conversion from a Date to String (in DateConversion#revert(Date) will return a formatted String using the date pattern provided in this class constructor
The date patterns must follows the pattern rules of java.
java.text.SimpleDateFormat
| Modifier and Type | Field and Description |
|---|---|
| private final String[] | |
| private final Locale | |
| private final SimpleDateFormat[] | |
| private final TimeZone |
| Access | Constructor and Description |
|---|---|
| public | DateConversion(TimeZone
the timeZone, Locale TimeZone of the date to be formattedthe locale, Date Locale that determines how the date mask should be formatted.default Date value to be returned when the input String is null. Used when valueIfStringIsNull, String ObjectConversion#execute(String) is invoked.default String value to be returned when a Date input is null. Used when valueIfObjectIsNull, String... DateConversion#revert(Date) is invoked.list of acceptable date patterns The first pattern in this sequence will be used to convert a Date into a String in dateFormats)DateConversion#revert(Date).Defines a conversion from String to |
| public | DateConversion(Locale
the locale, Date Locale that determines how the date mask should be formatted.default Date value to be returned when the input String is null. Used when valueIfStringIsNull, String ObjectConversion#execute(String) is invoked.default String value to be returned when a Date input is null. Used when valueIfObjectIsNull, String... DateConversion#revert(Date) is invoked.list of acceptable date patterns The first pattern in this sequence will be used to convert a Date into a String in dateFormats)DateConversion#revert(Date).Defines a conversion from String to |
| public | DateConversion(Date
default Date value to be returned when the input String is null. Used when valueIfStringIsNull, String ObjectConversion#execute(String) is invoked.default String value to be returned when a Date input is null. Used when valueIfObjectIsNull, String... DateConversion#revert(Date) is invoked.list of acceptable date patterns The first pattern in this sequence will be used to convert a Date into a String in dateFormats)DateConversion#revert(Date).Defines a conversion from String to |
| public | DateConversion(Locale
the locale, String... Locale that determines how the date mask should be formatted.list of acceptable date patterns The first pattern in this sequence will be used to convert a Date into a String in dateFormats)DateConversion#revert(Date).Defines a conversion from String to |
| public | DateConversion(String...
list of acceptable date patterns The first pattern in this sequence will be used to convert a Date into a String in dateFormats)DateConversion#revert(Date).Defines a conversion from String to |
| Modifier and Type | Method and Description |
|---|---|
| protected Date | Returns: the Date instance containing the date information represented by the given String, or the value ofvalueIfObjectIsNull if the String input is null.the String containing a formatted date which must be converted to a Date input)Implements abstract com. |
| public SimpleDateFormat[] | getFormatterObjects()
Implements com. |
| public TimeZone | |
| public String | Returns: a formatted date String representing the date provided by the given Date, or the value ofvalueIfObjectIsNull if the Date parameter is null.the Date to be converted to a String input)Overrides com. Implements com. |
| formats | back to summary |
|---|---|
| private final String[] formats | |
| locale | back to summary |
|---|---|
| private final Locale locale | |
| parsers | back to summary |
|---|---|
| private final SimpleDateFormat[] parsers | |
| timeZone | back to summary |
|---|---|
| private final TimeZone timeZone | |
| DateConversion | back to summary |
|---|---|
| public DateConversion(TimeZone timeZone, Locale locale, Date valueIfStringIsNull, String valueIfObjectIsNull, String... dateFormats) Defines a conversion from String to
| |
| DateConversion | back to summary |
|---|---|
| public DateConversion(Locale locale, Date valueIfStringIsNull, String valueIfObjectIsNull, String... dateFormats) Defines a conversion from String to
| |
| DateConversion | back to summary |
|---|---|
| public DateConversion(Date valueIfStringIsNull, String valueIfObjectIsNull, String... dateFormats) Defines a conversion from String to
| |
| DateConversion | back to summary |
|---|---|
| public DateConversion(Locale locale, String... dateFormats) Defines a conversion from String to
| |
| DateConversion | back to summary |
|---|---|
| public DateConversion(String... dateFormats) Defines a conversion from String to
| |
| fromString | back to summary |
|---|---|
| protected Date fromString(String input) Implements abstract com. Converts a formatted date String to an instance of Date. The pattern in the formatted date must match one of the date patterns provided in the constructor of this class. | |
| getFormatterObjects | back to summary |
|---|---|
| public SimpleDateFormat[] getFormatterObjects() Implements com. Doc from com. Returns the formatter objects
| |
| getTimeZone | back to summary |
|---|---|
| public TimeZone getTimeZone() | |
| revert | back to summary |
|---|---|
| public String revert(Date input) Overrides com. Implements com. Converts Date to a formatted date String. The pattern used to generate the formatted date is the first date pattern provided in the constructor of this class | |