why does DateTime.ToString(“dd/MM/yyyy”) give me dd-MM-yyyy?

Slash is a date delimiter, so that will use the current culture date delimiter.

If you want to hard-code it to always use slash, you can do something like this:

DateTime.ToString("dd"https://stackoverflow.com/"MM"https://stackoverflow.com/"yyyy")

Leave a Comment