public class DateFormatConverter
extends java.lang.Object
// returns "[$-0411]dd MMMM, yyyy;@" where the [$-0411] prefix tells Excel to use the Japanese locale
String excelFormatPattern = DateFormatConverter.convert(Locale.JAPANESE, "dd MMMM, yyyy");
CellStyle cellStyle = workbook.createCellStyle();
DataFormat poiFormat = workbook.createDataFormat();
cellStyle.setDataFormat(poiFormat.getFormat(excelFormatPattern));
cell.setCellValue(new Date());
cell.setCellStyle(cellStyle); // formats date as '2012?3?17?'
Modifier and Type | Class and Description |
---|---|
static class |
DateFormatConverter.DateFormatTokenizer |
Constructor and Description |
---|
DateFormatConverter() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convert(java.util.Locale locale,
java.text.DateFormat df) |
static java.lang.String |
convert(java.util.Locale locale,
java.lang.String format) |
static java.lang.String |
getJavaDatePattern(int style,
java.util.Locale locale) |
static java.lang.String |
getJavaDateTimePattern(int style,
java.util.Locale locale) |
static java.lang.String |
getJavaTimePattern(int style,
java.util.Locale locale) |
static java.lang.String |
getPrefixForLocale(java.util.Locale locale) |
public static java.lang.String getPrefixForLocale(java.util.Locale locale)
public static java.lang.String convert(java.util.Locale locale, java.text.DateFormat df)
public static java.lang.String convert(java.util.Locale locale, java.lang.String format)
public static java.lang.String getJavaDatePattern(int style, java.util.Locale locale)
public static java.lang.String getJavaTimePattern(int style, java.util.Locale locale)
public static java.lang.String getJavaDateTimePattern(int style, java.util.Locale locale)
Copyright © 2005-2010 Potix Corporation. All Rights Reserved.