org.apache.commons.convert
Class DateTimeConverters

java.lang.Object
  extended by org.apache.commons.convert.DateTimeConverters
All Implemented Interfaces:
ConverterLoader

public class DateTimeConverters
extends Object
implements ConverterLoader

Date/time Converter classes.


Nested Class Summary
static class DateTimeConverters.CalendarToDate
          An object that converts a Calendar to a Date.
static class DateTimeConverters.CalendarToLong
          An object that converts a Calendar to a Long.
static class DateTimeConverters.CalendarToString
          An object that converts a Calendar to a String.
static class DateTimeConverters.CalendarToTimestamp
          An object that converts a Calendar to a Timestamp.
static class DateTimeConverters.DateToCalendar
          An object that converts a Date to a Calendar.
static class DateTimeConverters.DateToSqlDate
          An object that converts a java.util.Date to a java.sql.Date.
static class DateTimeConverters.DateToSqlTime
          An object that converts a java.util.Date to a java.sql.Time.
static class DateTimeConverters.DateToString
          An object that converts a java.util.Date to a String.
static class DateTimeConverters.DateToTimestamp
          An object that converts a java.util.Date to a java.sql.Timestamp.
static class DateTimeConverters.GenericDateToLong<S extends Date>
          An object that converts a java.util.Date (and its subclasses) to a Long.
static class DateTimeConverters.GenericLocalizedConverter<S,T>
           
static class DateTimeConverters.LongToCalendar
          An object that converts a Long to a Calendar.
static class DateTimeConverters.LongToDate
          An object that converts a Long to a java.util.Date.
static class DateTimeConverters.LongToSqlDate
          An object that converts a Long to a java.sql.Date.
static class DateTimeConverters.LongToSqlTime
          An object that converts a Long to a java.sql.Time.
static class DateTimeConverters.LongToTimestamp
          An object that converts a Long to a java.sql.Timestamp.
static class DateTimeConverters.SqlDateToDate
          An object that converts a java.sql.Date to a java.util.Date.
static class DateTimeConverters.SqlDateToString
          An object that converts a java.sql.Date to a String.
static class DateTimeConverters.SqlDateToTimestamp
          An object that converts a java.sql.Date to a java.sql.Timestamp.
static class DateTimeConverters.SqlTimeToString
          An object that converts a java.sql.Time to a String.
static class DateTimeConverters.StringToCalendar
          An object that converts a String to a java.util.Calendar.
static class DateTimeConverters.StringToDate
          An object that converts a String to a java.util.Date.
static class DateTimeConverters.StringToSqlDate
          An object that converts a String to a java.sql.Date.
static class DateTimeConverters.StringToSqlTime
          An object that converts a String to a java.sql.Time.
static class DateTimeConverters.StringToTimestamp
          An object that converts a String to a java.sql.Timestamp.
static class DateTimeConverters.StringToTimeZone
          An object that converts a String ID to a java.util.TimeZone.
static class DateTimeConverters.TimestampToDate
          An object that converts a java.sql.Timestamp to a java.util.Date.
static class DateTimeConverters.TimestampToSqlDate
          An object that converts a java.sql.Timestamp to a java.sql.Date.
static class DateTimeConverters.TimestampToSqlTime
          An object that converts a java.sql.Timestamp to a java.sql.Time.
static class DateTimeConverters.TimestampToString
          An object that converts a java.sql.Timestamp to a String.
static class DateTimeConverters.TimeZoneToString
          An object that converts a java.util.TimeZone to a String ID.
 
Field Summary
static String CALENDAR_FORMAT
          Calendar format string: EEE MMM dd HH:mm:ss.SSS z yyyy.
static String JDBC_DATE_FORMAT
          JDBC DATE format string: yyyy-MM-dd.
static String JDBC_TIME_FORMAT
          JDBC TIME format string: HH:mm:ss.
 
Constructor Summary
DateTimeConverters()
           
 
Method Summary
 void loadConverters()
          Create and register converters with the Java object type conversion framework.
protected static DateFormat toDateFormat(TimeZone tz)
          Returns an initialized DateFormat object.
protected static DateFormat toDateTimeFormat(String dateTimeFormat, TimeZone tz, Locale locale)
          Returns an initialized DateFormat object.
protected static DateFormat toTimeFormat(TimeZone tz)
          Returns an initialized DateFormat object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CALENDAR_FORMAT

public static final String CALENDAR_FORMAT
Calendar format string: EEE MMM dd HH:mm:ss.SSS z yyyy.

See Also:
Constant Field Values

JDBC_DATE_FORMAT

public static final String JDBC_DATE_FORMAT
JDBC DATE format string: yyyy-MM-dd.

See Also:
Constant Field Values

JDBC_TIME_FORMAT

public static final String JDBC_TIME_FORMAT
JDBC TIME format string: HH:mm:ss.

See Also:
Constant Field Values
Constructor Detail

DateTimeConverters

public DateTimeConverters()
Method Detail

toDateFormat

protected static DateFormat toDateFormat(TimeZone tz)
Returns an initialized DateFormat object.

Parameters:
tz -
Returns:
DateFormat object

toDateTimeFormat

protected static DateFormat toDateTimeFormat(String dateTimeFormat,
                                             TimeZone tz,
                                             Locale locale)
Returns an initialized DateFormat object.

Parameters:
dateTimeFormat - optional format string
tz -
locale - can be null if dateTimeFormat is not null
Returns:
DateFormat object

toTimeFormat

protected static DateFormat toTimeFormat(TimeZone tz)
Returns an initialized DateFormat object.

Parameters:
tz -
Returns:
DateFormat object

loadConverters

public void loadConverters()
Description copied from interface: ConverterLoader
Create and register converters with the Java object type conversion framework. If the converter extends one of the converter abstract classes, then the converter will register itself when an instance is created. Otherwise, call Converters.registerConverter(Converter) with the Converter instance.

Specified by:
loadConverters in interface ConverterLoader


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.