Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
Excel date format string not applied
posted

Hi,

I have been trying to set the date format to worksheet cell but it not working. Here's what i have - 

row.Cells[columnIndex].CellFormat.FormatString = "mm/dd/yyyy h:mm AM/PM";
row.Cells[columnIndex].CellFormat.Alignment = HorizontalCellAlignment.Right;

Due to this the filter does not work as expected. The column is considered as a text - 

But the same when i do by opening the Excel from my system and then set the format, the column is correctly set as Date and the filter looks like below - 

The one in the second image is the expected outcome.

Can you please help me fix this ?

Parents Reply Children