Package org.apache.log4j.lf5.util
Class DateFormatManager
- java.lang.Object
-
- org.apache.log4j.lf5.util.DateFormatManager
-
public class DateFormatManager extends java.lang.Object
Date format manager. Utility class to help manage consistent date formatting and parsing. It may be advantageous to have multiple DateFormatManagers per application. For example, one for handling the output (formatting) of dates, and another one for handling the input (parsing) of dates.
-
-
Field Summary
Fields Modifier and Type Field Description private java.text.DateFormat
_dateFormat
private java.util.Locale
_locale
private java.lang.String
_pattern
private java.util.TimeZone
_timeZone
-
Constructor Summary
Constructors Constructor Description DateFormatManager()
DateFormatManager(java.lang.String pattern)
DateFormatManager(java.util.Locale locale)
DateFormatManager(java.util.Locale locale, java.lang.String pattern)
DateFormatManager(java.util.TimeZone timeZone)
DateFormatManager(java.util.TimeZone timeZone, java.lang.String pattern)
DateFormatManager(java.util.TimeZone timeZone, java.util.Locale locale)
DateFormatManager(java.util.TimeZone timeZone, java.util.Locale locale, java.lang.String pattern)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private void
configure()
java.lang.String
format(java.util.Date date)
java.lang.String
format(java.util.Date date, java.lang.String pattern)
java.text.DateFormat
getDateFormatInstance()
java.util.Locale
getLocale()
java.lang.String
getOutputFormat()
Deprecated.Use getPattern().java.lang.String
getPattern()
java.util.TimeZone
getTimeZone()
java.util.Date
parse(java.lang.String date)
java.util.Date
parse(java.lang.String date, java.lang.String pattern)
void
setDateFormatInstance(java.text.DateFormat dateFormat)
void
setLocale(java.util.Locale locale)
void
setOutputFormat(java.lang.String pattern)
Deprecated.Use setPattern().void
setPattern(java.lang.String pattern)
Set the pattern.void
setTimeZone(java.util.TimeZone timeZone)
-
-
-
Constructor Detail
-
DateFormatManager
public DateFormatManager()
-
DateFormatManager
public DateFormatManager(java.util.TimeZone timeZone)
-
DateFormatManager
public DateFormatManager(java.util.Locale locale)
-
DateFormatManager
public DateFormatManager(java.lang.String pattern)
-
DateFormatManager
public DateFormatManager(java.util.TimeZone timeZone, java.util.Locale locale)
-
DateFormatManager
public DateFormatManager(java.util.TimeZone timeZone, java.lang.String pattern)
-
DateFormatManager
public DateFormatManager(java.util.Locale locale, java.lang.String pattern)
-
DateFormatManager
public DateFormatManager(java.util.TimeZone timeZone, java.util.Locale locale, java.lang.String pattern)
-
-
Method Detail
-
getTimeZone
public java.util.TimeZone getTimeZone()
-
setTimeZone
public void setTimeZone(java.util.TimeZone timeZone)
-
getLocale
public java.util.Locale getLocale()
-
setLocale
public void setLocale(java.util.Locale locale)
-
getPattern
public java.lang.String getPattern()
-
setPattern
public void setPattern(java.lang.String pattern)
Set the pattern. i.e. "EEEEE, MMMMM d, yyyy hh:mm aaa"
-
getOutputFormat
public java.lang.String getOutputFormat()
Deprecated.Use getPattern().This method has been deprecated in favour of getPattern().
-
setOutputFormat
public void setOutputFormat(java.lang.String pattern)
Deprecated.Use setPattern().This method has been deprecated in favour of setPattern().
-
getDateFormatInstance
public java.text.DateFormat getDateFormatInstance()
-
setDateFormatInstance
public void setDateFormatInstance(java.text.DateFormat dateFormat)
-
format
public java.lang.String format(java.util.Date date)
-
format
public java.lang.String format(java.util.Date date, java.lang.String pattern)
-
parse
public java.util.Date parse(java.lang.String date) throws java.text.ParseException
- Throws:
java.text.ParseException
-
parse
public java.util.Date parse(java.lang.String date, java.lang.String pattern) throws java.text.ParseException
- Throws:
java.text.ParseException
-
configure
private void configure()
-
-