This is the code I have:
DateTime.Now.AddMinutes(55).ToString("dd/MM/yyyy HH:mm:ss")
The string I get from that code is:
"16.09.2013 19:45:03"
The question is, why the string is not in the format I've provided?
To do this, you use the "MM/yyyy" format string. The format string uses the current culture's date separator. Getting a string that contains the date and time in a specific format. For example, the "MM/dd/yyyyHH:mm" format string displays the date and time string in a fixed format such as "19//03//2013 18:06".
Use this:
DateTime.Now.AddMinutes(55).ToString("dd'/'MM'/'yyyy HH:mm:ss")
because /
means default date separator, so it's associated with your current culture. So know it will use always /
here, no matter of current culture.
Read more here at MSDN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With