public class DateTimeTransformer extends DateTransformerBase
A specialized transformer that transforms strings into date objects with both a date and time component.
This transformer class allows user to enter a date and a time in a single
input field, such as 1/31/2008 10:19
. Most of the required
functionality is already implemented by the base class. This class creates an
appropriate DateFormat
object that supports parsing time
stamps.
For the documentation of the supported error messages refer to the super
class. In addition to the properties defined by
DateTransformerBase
, the following properties can be set:
Property | Description | Default |
---|---|---|
timeStyle | Defines the style of the time component. This can be one of the style
constants declared by the java.text.DateFormat class like
SHORT or FULL . While the style for the date
component is set by the inherited style property, with this
property the style for the time component can be set separately. |
SHORT |
Modifier and Type | Field and Description |
---|---|
protected static String |
PROP_TIME_STYLE
Constant for the time style property.
|
PROP_AFTER, PROP_BEFORE, PROP_EQUAL, PROP_LENIENT, PROP_REFERENCE_DATE, PROP_STYLE
Constructor and Description |
---|
DateTimeTransformer()
Creates a new instance of
DateTimeTransformer . |
Modifier and Type | Method and Description |
---|---|
protected DateFormat |
createFormat(Locale locale,
int style,
org.apache.commons.configuration.Configuration config)
Creates the format object to be used by this transformer.
|
int |
getTimeStyle()
Returns the style for the time portion.
|
void |
setTimeStyle(int timeStyle)
Sets the style for the time.
|
errorResult, getDefaultReferenceDate, getReferenceDate, getReferenceDateProperty, getStyle, initializeFormat, isAfter, isBefore, isDateValid, isEqual, isLenient, isValid, setAfter, setBefore, setEqual, setLenient, setReferenceDate, setStyle, transform, transformDate, transformSqlDate, transformToDate, transformToString, updateDatePart, updateTimePart
protected static final String PROP_TIME_STYLE
public DateTimeTransformer()
DateTimeTransformer
.public int getTimeStyle()
public void setTimeStyle(int timeStyle)
java.text.DateFormat
(e.g. SHORT
,
MEDIUM
etc.) can be passed in.timeStyle
- the style for the timeprotected DateFormat createFormat(Locale locale, int style, org.apache.commons.configuration.Configuration config)
DateFormat
.createFormat
in class DateTransformerBase
locale
- the localestyle
- the style for the date portionconfig
- the configuration with the propertiesCopyright © 2016 The JGUIraffe Team. All rights reserved.