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

Free Support Forum - aspose.com

Issue in date time field in EXcel


I am using then following line of code to present date time field in mm/dd/yy. but showing in numbers like 80897

workSheet.Cells[cell + row.ToString()].PutValue(


Style style = workSheet.Cells[cell + row.ToString()].GetStyle();

style.Number = 14;

workSheet.Cells[cell + row.ToString()].SetStyle(style);

pls provide me support on the same. thanks in advance.

Hi Vimlesh,

Thank you for contacting Aspose support.

If you wish to format the data according to a format that is not available as predefined formats then please use the Style.Custom property to set the format accordingly. Please check the below provided code snippet & its resultant spreadsheet.


var book = new Workbook();
var workSheet = book.Worksheets[0];
Style style = workSheet.Cells[0].GetStyle();
style.Custom = “dd/mm/yy”;

Adding more, we have evaluated this case while using the latest version of Aspose.Cells for .NET 8.3.1. In case the problem persists with your current version of the API then please upgrade the API to latest revision.


Please change the line of code:
workSheet.Cells[cell + row.ToString()].PutValue(Convert.ToDateTime(dataRow[“SURVEY_DATE”].ToString()));

workSheet.Cells[cell + row.ToString()].PutValue(Convert.ToDateTime(dataRow[“SURVEY_DATE”].ToString()), true);

it should work fine now

Let us know if you still find any issue.

Thank you.

Hi ,

I implemented the same code but get 6000 in date time filed. code is below



Style style = workSheet.Cells["A2"].GetStyle();

style.Custom =




please provide the support on the same.


vimlesh Singh


Did you try my suggestion in my previous post? please try it if possible.

It looks like an issue with your underlying “SURVEY_DATE” column’s values in your table. Well, we require your sample code (runnable) to evaluate your issue properly. We appreciate if you could provide us a sample code (runnable) same as Babar pasted in his previous post, or preferably a sample console application (runnable), zip it and post us here to reproduce the issue on our end. Please remove any interdependencies regarding data sources or data set, instead please use dynamic DataTable in your codes when creating the sample console application. Also attach the template files, we will check it soon.

Thank you.