As the title says, I'd like to set a specific datetime format for a specific range of cells.
I've found 1 topic talking about it, but it doesn't work completely.
Here is what I have in my column cells : 01/01/2000 00:00
Here is what I want : 2000-01-01 00:00:00
And here is what I've tried so far :
- Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile(Inputfile);
Worksheet sheet = workbook.Worksheets[0];
Inputfile = Path.ChangeExtension(Inputfile, ".csv");
sheet.Columns[2].NumberFormat = "yyyy-mm-dd hh:mm:ss";
sheet.SaveToFile(Inputfile, ";", Encoding.UTF8);
sheet.SaveToFile(Inputfile, ";", Encoding.UTF8);
The problem is always near "-" in the datetime format that doesn't seem to be applied. So I've tried multiple things but it never worked.
I also tried to use :
sheet.Columns[2].TextPartReplace(".", "-");
But I always have dots instead of what I want and the seconds are not always here.
Thanks