Package org.apache.poi.ss.usermodel
Class ExcelStyleDateFormatter
- java.lang.Object
-
- java.text.Format
-
- java.text.DateFormat
-
- java.text.SimpleDateFormat
-
- org.apache.poi.ss.usermodel.ExcelStyleDateFormatter
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class ExcelStyleDateFormatter extends java.text.SimpleDateFormat
A wrapper around aSimpleDateFormat
instance, which handles a few Excel-style extensions that are not supported bySimpleDateFormat
. Currently, the extensions are around the handling of elapsed time, eg rendering 1 day 2 hours as 26 hours.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static char
H_BRACKET_SYMBOL
static char
HH_BRACKET_SYMBOL
static char
L_BRACKET_SYMBOL
static char
LL_BRACKET_SYMBOL
static char
M_BRACKET_SYMBOL
static char
MM_BRACKET_SYMBOL
static char
MMMMM_START_SYMBOL
static char
MMMMM_TRUNCATE_SYMBOL
static char
S_BRACKET_SYMBOL
static char
SS_BRACKET_SYMBOL
-
Fields inherited from class java.text.DateFormat
AM_PM_FIELD, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
-
-
Constructor Summary
Constructors Constructor Description ExcelStyleDateFormatter(java.lang.String pattern)
ExcelStyleDateFormatter(java.lang.String pattern, java.text.DateFormatSymbols formatSymbols)
ExcelStyleDateFormatter(java.lang.String pattern, java.util.Locale locale)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.StringBuffer
format(java.util.Date date, java.lang.StringBuffer paramStringBuffer, java.text.FieldPosition paramFieldPosition)
int
hashCode()
void
setDateToBeFormatted(double date)
Used to let us know what the date being formatted is, in Excel terms, which we may wish to use when handling elapsed times.-
Methods inherited from class java.text.SimpleDateFormat
applyLocalizedPattern, applyPattern, clone, formatToCharacterIterator, get2DigitYearStart, getDateFormatSymbols, parse, set2DigitYearStart, setDateFormatSymbols, toLocalizedPattern, toPattern
-
Methods inherited from class java.text.DateFormat
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone
-
-
-
-
Field Detail
-
MMMMM_START_SYMBOL
public static final char MMMMM_START_SYMBOL
- See Also:
- Constant Field Values
-
MMMMM_TRUNCATE_SYMBOL
public static final char MMMMM_TRUNCATE_SYMBOL
- See Also:
- Constant Field Values
-
H_BRACKET_SYMBOL
public static final char H_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
HH_BRACKET_SYMBOL
public static final char HH_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
M_BRACKET_SYMBOL
public static final char M_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
MM_BRACKET_SYMBOL
public static final char MM_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
S_BRACKET_SYMBOL
public static final char S_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
SS_BRACKET_SYMBOL
public static final char SS_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
L_BRACKET_SYMBOL
public static final char L_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
LL_BRACKET_SYMBOL
public static final char LL_BRACKET_SYMBOL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExcelStyleDateFormatter
public ExcelStyleDateFormatter(java.lang.String pattern)
-
ExcelStyleDateFormatter
public ExcelStyleDateFormatter(java.lang.String pattern, java.text.DateFormatSymbols formatSymbols)
-
ExcelStyleDateFormatter
public ExcelStyleDateFormatter(java.lang.String pattern, java.util.Locale locale)
-
-
Method Detail
-
setDateToBeFormatted
public void setDateToBeFormatted(double date)
Used to let us know what the date being formatted is, in Excel terms, which we may wish to use when handling elapsed times.
-
format
public java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer paramStringBuffer, java.text.FieldPosition paramFieldPosition)
- Overrides:
format
in classjava.text.SimpleDateFormat
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.text.SimpleDateFormat
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.text.SimpleDateFormat
-
-