I'm trying to set a cell to a Date Format but when I open the .xls it says the cells are "Edited" format.
the code that I use:
if(System.DateTime.TryParse(value, out datum))
{
worksheet.Cells[rowIndex, colInx + 1].Style.Numberformat.Format = "dd-MM-yyyy";
worksheet.Cells[rowIndex, colInx + 1].Value = datum.ToShortDateString();
}
but in excel it'll say "Aangepast"("Edited")
instead of "Date"
:
Solved the problem with the following code:
worksheet.Cells[rowIndex, colInx + 1].Style.Numberformat.Format = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
this takes the datetimeformat of the short date from your local windows