0

I am adding 14 days to the current day and then I wanna export this to excel. in Visual Studio it shows the date as 26-03-2019. But the moment I export it to Excel it shows it in the cell-like 26/03/2019. My questions are how can I change this?

I changed the date format but this doesn't work.

This is my code.

Textbox1.Text = DateTime.Now.AddDays(14).ToString("dd-MM-yyyy");

worksheet.Cells[1, 2] = Textbox1.Text;

I dont know what I should change to get the date format in 26-03-2019 instead of 26/03/2019 in excel.

George C.
  • 6,574
  • 12
  • 55
  • 80
Farah
  • 11
  • 5
    You would need to change the display format of the cell: https://stackoverflow.com/questions/3310800/how-to-make-correct-date-format-when-writing-data-to-excel – Alex K. Mar 26 '19 at 16:28
  • Possible duplicate of [How to make correct date format when writing data to Excel](https://stackoverflow.com/questions/3310800/how-to-make-correct-date-format-when-writing-data-to-excel) – double-beep Mar 26 '19 at 17:28

0 Answers0