I want to have date as 02/03/2017
for 3 March 2017 in my mvc view.
With DateTime.ToString("dd/MM/yyyy")
I just get 02 03 2017
. Why is my slashes going away?
I want to have date as 02/03/2017
for 3 March 2017 in my mvc view.
With DateTime.ToString("dd/MM/yyyy")
I just get 02 03 2017
. Why is my slashes going away?
You might need to provide a culture for your to string.
DateTime.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
Escape slashes:
var result = MyDateTime.ToString("dd'/'MM'/'yyyy");