We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Date prior to 2000 are incorrectly parsed

We need some guidance on how to fix the problem that we have with date years that are prior to 2000. If we take for example this date: 12/03/98, and we insert it into Aspose Worksheet using cell.PutValue(“12/03/98”, true, true), with format =“d/mm/yyyy” instead of having 12/03/1998 we have 12/03/98 (and when we select the cell we have 12/03/2098)


Here is the code that we are using to reproduce the problem:
Aspose version: 16.10.0.0;
using System;
using Aspose.Cells;

namespace Reproducer
{
public class Program
{
public static void Main(string[] args)
{
PutDateValue();
}


public static void PutDateValue()
{
var testDateValue = “12/03/98”;
const string customFormat = “m/dd/yyy”;

var workbook = new Workbook();

var worksheet = workbook.Worksheets[0];

var cell = worksheet.Cells[0, 0];

/*
* This should output 12/03/1998 but it outputs in
* Excel 12/03/98 ( and when you select the cell it shows 12/3/2098
/
cell.PutValue(testDateValue, true, true);
var style = cell.GetStyle();
style.SetCustom(customFormat, false);

cell = worksheet.Cells[0, 1];
var date = DateTime.Parse(testDateValue);
/
* This should output 12/03/1998 but it outputs in
* Excel 0/03/1998
*/
cell.PutValue(date.ToString(customFormat), true, true);

workbook.Save(“date.xlsx”);
}
}
}

We need guidance ASAP on how to fix the problem and to make sure dates, appear as we are expecting them to appear.

Hi,


Thanks for providing us sample code with details.

After an initial test, I observed the issue as you mentioned by using your sample code. I found Date values prior to 2000 are incorrectly parsed. For example, insert a date: 12/03/98 into a worksheet using cell.PutValue(“12/03/98”, true, true), with format =“d/mm/yyyy” instead of having 12/03/1998 we have 12/03/98 (and when we select the cell we have 12/03/2098). I have logged an investigation ticket with an id “CELLSNET-44965” for your issue. We will look into it if this is expected behavior or something else. If we have confirmed that this is an issue, we will figure it out or provide you some workaround to cope with it.

Once we have an update on it, we will let you know here.

Thank you.

Hi again,


This is to update you that the ticket logged earlier as CELLSNET-44965 has been marked resolved. We will shortly share the fix here for your testing.
Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v16.11.10 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-44965) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.