I am running aspose.cells 8.4.0 and when i open a csv file and try to get a date from a column
then i am getting a wrong date.
Date expected: 11.03.2015
Date in string value = "2015-03-11"
Date in DateTime Value = {03.11.2015 00:00:00}
Date in HTMLString = "<Font Style=“FONT-FAMILY: Arial;FONT-SIZE: 10pt;COLOR: #000000;”>2015-03-11"
Looks like that the datetime parsing works incorrect and only assumes US format (mm/dd/yyyy)
Please see screenshot.
Need urgently a solution.
Thanks
Hi,
Thanks for your posting and using Aspose.Cells.
It might be a correct behavior. However, to investigate this issue thoroughly, we need your sample console project and csv file so that we could run it at our end and observe this issue and in case of a bug fix it in our newer versions.
Please also download and try the latest version: Aspose.Cells for .NET 8.4.0 and see if it makes any difference with this issue.
The behaviour can’t be correct.
Please find attached the console project where you can verify what happens.
Thanks
Hi,
Thanks for your posting and using Aspose.Cells.
I have tested this issue with the following sample code and I found that Aspose.Cells should print 13.04.2015 but it prints 2015-04-13.
Let me know if got it right. I have run this code after setting my Country and Regional settings to German (Germany)
C#
string filePath = @“F:\Shak-Data-RW\Downloads\AsposeDateIssueCSV\AsposeDateIssueCSV\AsposeDateIssue.csv”;
TxtLoadOptions opts = new TxtLoadOptions();
opts.LanguageCode = CountryCode.Germany;
opts.Region = CountryCode.Germany;
Workbook workbook = new Workbook(filePath, opts);
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet.Cells[1, 4];
//It should print
//13.04.2015
//but it prints
//2015-04-13
Debug.WriteLine(cell.StringValue);
My problem is not that the stringvalue is formated 'yyyy-MM-dd’
The problem is the DateTimeValue property which simple shows november instead of March !
Expected Result = 11.03.2015
Actual Result = 03.11.2015
Hi,
Thanks for your posting and using Aspose.Cells.
We were able to notice this issue with the following sample code. We found that the date value 13-04-2015 was read correctly as 13-Apr-2015 but the date value 11-03-2015 was confused and it should be read as 11-Mar-2015 but it was read as 03-Nov-2015. So the Day and Month is interchanged.
We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
- CELLSNET-43493 - Day and Month is interchanged while reading the DateTime value
C#
string filePath = @“F:\Shak-Data-RW\Downloads\AsposeDateIssue.csv”;
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet.Cells[“E2”];
//This prints ok i.e
//13-Apr-2015 12:00:00 AM
Debug.WriteLine(cell.DateTimeValue.ToString());
cell = worksheet.Cells[“E7”];
//This should print
//11-Mar-2015 12:00:00 AM
//but it prints
//03-Nov-2015 12:00:00 AM
Debug.WriteLine(cell.DateTimeValue.ToString());
Hi,
Thanks for using Aspose.Cells.
We have looked into this issue further and found it is not the bug of Aspose.Cells and it is working correctly. That means the default date format for your default regional
settings is month/day/year. You should set the proper region whose
default date format is day/month/year then cells can read/parse the
datetime value as you expected.