public class FmtDate extends CellProcessorAdaptor implements DateCellProcessor
SimpleDateFormat
class. If you want to convert from a
String to a Date, use the ParseDate
processor.
Some example date formats you can use are:
"dd/MM/yyyy"
(formats a date as "25/12/2011")
"dd-MMM-yy"
(formats a date as "25-Dec-11")
"yyyy.MM.dd.HH.mm.ss"
(formats a date as "2011.12.25.08.36.33"
"E, dd MMM yyyy HH:mm:ss Z"
(formats a date as "Tue, 25 Dec 2011 08:36:33 -0500")
next
Constructor and Description |
---|
FmtDate(String dateFormat)
Constructs a new FmtDate processor, which converts a date into a formatted string using
SimpleDateFormat.
|
FmtDate(String dateFormat,
StringCellProcessor next)
Constructs a new FmtDate processor, which converts a date into a formatted string using
SimpleDateFormat, then calls the next processor in the chain.
|
Modifier and Type | Method and Description |
---|---|
Object |
execute(Object value,
CsvContext context)
This method is invoked by the framework when the processor needs to process data or check constraints.
|
toString, validateInputNotNull
public FmtDate(String dateFormat)
dateFormat
- the date format String (see SimpleDateFormat
)NullPointerException
- if dateFormat is nullpublic FmtDate(String dateFormat, StringCellProcessor next)
dateFormat
- the date format String (see SimpleDateFormat
)next
- the next processor in the chainNullPointerException
- if dateFormat or next is nullpublic Object execute(Object value, CsvContext context)
execute
in interface CellProcessor
value
- the value to be processedcontext
- the CSV contextSuperCsvCellProcessorException
- if value is null or is not a Date, or if dateFormat is not a valid date formatCopyright © 2007–2015 Super CSV. All rights reserved.