Free Support Forum - aspose.com

Custom Date format setting issue!

Hi team,

Im having some problems with formatting the date for a column using Aspose.Cells for .NET 2.0. Im creating a excel .document from a database with a date column in each row, but i cant get the date right in excel. I have setted the custom format date and my code is below,

Cells cells = obj.ExcelWorkBook.Worksheets[0].Cells;

cells["H" + (j + 6)].PutValue(Convert.ToDateTime(dt.Rows[j]["ATS"].ToString()));

cells["H" + (j + 6)].Style.Custom = "dd/mm/yyyy";


but this one is working but it will apper hours and sec also?
how i try to set "dd/mm/yyyy" format ? Can anyone help me getting it right? i have attached Error Image also.

Hi,

I think you may try to change your code to following if it works fine for your requirement.


Cells cells = obj.ExcelWorkBook.Worksheets[0].Cells;

cells["H" + (j + 6)].PutValue(dt.Rows[j]["ATS"].ToString(), true);

cells["H" + (j + 6)].Style.Custom = "dd/mm/yyyy";




Thank you.

Hi,

This is not working .I got the same issue. Any other option avilable?

Thanks

Samy T

Hi,

Could you create a simple console application to show the issue, we will check it soon.

Thank you.