I have an _xlsx_ file with several dates.
One cell appears in Excel 2007 (configured as Spanish, Spain, international) as "01/02/2003 4:05" (that is 1st February 2003). The cell format appears as "dd/mm/aaaa h:mm" in Excel. NPOI gets "2/1/03 4:05".
What appears as "01/12/2001" is read by NPOI as "12/1/01". The cell format is "*14/03/2001" in Excel.
What appears as "23:05:00" is read by NPOI as "11:05:00 ". The cell format is "*13:30:55" in Excel.
The code I use to read the file is:
```
DataFormatter dataFormatter= new DataFormatter(CultureInfo.CurrentCulture); // es-ES
// ...
object cellValue= dataFormatter.FormatCellValue(ijCell);
```
In some cases, I see that NPOI is applying the predefined formats from _NPOI.SS.UserModel.BuiltinFormats_, but they seem not to match what Spanish Excel does.
Is there a way to make NPOI use the same format as Spanish Excel?
Comments: ** Comment from web user: tonyqus **
One cell appears in Excel 2007 (configured as Spanish, Spain, international) as "01/02/2003 4:05" (that is 1st February 2003). The cell format appears as "dd/mm/aaaa h:mm" in Excel. NPOI gets "2/1/03 4:05".
What appears as "01/12/2001" is read by NPOI as "12/1/01". The cell format is "*14/03/2001" in Excel.
What appears as "23:05:00" is read by NPOI as "11:05:00 ". The cell format is "*13:30:55" in Excel.
The code I use to read the file is:
```
DataFormatter dataFormatter= new DataFormatter(CultureInfo.CurrentCulture); // es-ES
// ...
object cellValue= dataFormatter.FormatCellValue(ijCell);
```
In some cases, I see that NPOI is applying the predefined formats from _NPOI.SS.UserModel.BuiltinFormats_, but they seem not to match what Spanish Excel does.
Is there a way to make NPOI use the same format as Spanish Excel?
Comments: ** Comment from web user: tonyqus **
I have to say this case is possible because there is an builtin convertion between Excel data formats to .NET datetime formatting. It's suggested you read the Date value from ICell.CellDateValue because this is the real DateTime value. Data formats is just a shell.