Top Description Inners Fields Constructors Methods
org.apache.poi.ss.format

public Class CellDateFormatter

extends CellFormatter
Class Inheritance
Imports
java.text.AttributedCharacterIterator, .CharacterIterator, .DateFormat, .SimpleDateFormat, java.util.Calendar, .Date, .Formatter, .Locale, java.util.regex.Matcher, org.apache.poi.util.LocaleUtil, .StringUtil

Formats a date value.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private boolean
private final DateFormat
private static final Calendar
private static final int
private String
private boolean
private boolean
private static CellDateFormatter
Inherited from org.apache.poi.ss.format.CellFormatter:
formatlocale

Constructor Summary

AccessConstructor and Description
public
CellDateFormatter(String
The format.
format
)

Creates a new date formatter with the given specification.

public
CellDateFormatter(Locale
The locale.
locale
,
String
The format.
format
)

Creates a new date formatter with the given specification.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
formatValue(StringBuffer
The buffer to append to.
toAppendTo
,
Object
The value to format.
value
)

Implements abstract org.apache.poi.ss.format.CellFormatter.formatValue.

Format a value according the format string.

public void
simpleValue(StringBuffer
The buffer to append to.
toAppendTo
,
Object
The value to format.
value
)

Implements abstract org.apache.poi.ss.format.CellFormatter.simpleValue.

Format a value according to the type, in the most basic way.

Inherited from org.apache.poi.ss.format.CellFormatter:
formatquotesimpleFormat

Field Detail

amPmUpperback to summary
private boolean amPmUpper
dateFmtback to summary
private final DateFormat dateFmt
EXCEL_EPOCH_CALback to summary
private static final Calendar EXCEL_EPOCH_CAL
NUM_MILLISECONDS_IN_DAYback to summary
private static final int NUM_MILLISECONDS_IN_DAY
sFmtback to summary
private String sFmt
showAmPmback to summary
private boolean showAmPm
showMback to summary
private boolean showM
SIMPLE_DATE_FORMATTERback to summary
private static CellDateFormatter SIMPLE_DATE_FORMATTER

Constructor Detail

CellDateFormatterback to summary
public CellDateFormatter(String format)

Creates a new date formatter with the given specification.

Parameters
format:String

The format.

CellDateFormatterback to summary
public CellDateFormatter(Locale locale, String format)

Creates a new date formatter with the given specification.

Parameters
locale:Locale

The locale.

format:String

The format.

Method Detail

formatValueback to summary
public synchronized void formatValue(StringBuffer toAppendTo, Object value)

Implements abstract org.apache.poi.ss.format.CellFormatter.formatValue.

Doc from org.apache.poi.ss.format.CellFormatter.formatValue.

Format a value according the format string.

Note

this method must be thread safe! In particular, if it uses a Format instance that is not thread safe, i.e. DateFormat, this method must be synchronized, either on the method, if the format is a final property, or on the format instance itself.

Parameters
toAppendTo:StringBuffer

The buffer to append to.

value:Object

The value to format.

Annotations
@Override
simpleValueback to summary
public void simpleValue(StringBuffer toAppendTo, Object value)

Implements abstract org.apache.poi.ss.format.CellFormatter.simpleValue.

Doc from org.apache.poi.ss.format.CellFormatter.simpleValue.

Format a value according to the type, in the most basic way.

Note

this method must be thread safe! In particular, if it uses a Format instance that is not thread safe, i.e. DateFormat, this method must be synchronized, either on the method, if the format is a final property, or on the format instance itself.

For a date, this is "mm/d/y".

Parameters
toAppendTo:StringBuffer

The buffer to append to.

value:Object

The value to format.

Annotations
@Override
org.apache.poi.ss.format back to summary

pack-priv Class CellDateFormatter.DatePartHandler

extends Object
implements PartHandler
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.format.CellFormatPart.PartHandler

Field Summary

Modifier and TypeField and Description
private int
private int
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
finish(StringBuffer toAppendTo)

public String
public void
updatePositions(int pos, int offset)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hLenback to summary
private int hLen
hStartback to summary
private int hStart
mLenback to summary
private int mLen
mStartback to summary
private int mStart

Constructor Detail

DatePartHandlerback to summary
pack-priv DatePartHandler()

Method Detail

finishback to summary
public void finish(StringBuffer toAppendTo)
handlePartback to summary
public String handlePart(Matcher m, String part, CellFormatType type, StringBuffer desc)

Implements org.apache.poi.ss.format.CellFormatPart.PartHandler.handlePart.

Annotations
@Override
updatePositionsback to summary
public void updatePositions(int pos, int offset)