I’m facing a problem that I need to write the date of tomorrow and it keeps pasting the hour. I need to remove the hour from the Excel file.
- quick dirty trick - prepend a ’ before the value when writing it to Excel. So Excel is forced to treat is as text
- reformat the cell afterwards
You can use date.now.adddays(1).tostring.“dd/MM/yyyy”).replace(" 00:00:00",string.empty)
tomorrowDate = DateTime.Now.Date.AddDays(1)
Like this?
Date.Now.AddDays(1).ToString(“'dd/MM/yyyy”)
we interpret your question relating the quick dirty trick. Otherwise use a few words more
String.Format("'{0}", DateTime.Now.AddDays(1).ToString("dd/MM/yyyy"))
Or
DateTime.Now.AddDays(1).toString("\'dd/MM/yyyy")
You’re the man! Thank you very much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.