I am trying to get todays date in GBR format but,
DateTime.Now.ToString("dd/mm/yyyy");
returns with the value of 08/00/2013
So 00
in the month group was returned instead of returning the month 04
.
Any ideas why this happened?
Lower mm
means minutes, so
DateTime.Now.ToString("dd/MM/yyyy");
or
DateTime.Now.ToString("d");
or
DateTime.Now.ToShortDateString()
works.
Standard Date and Time Format Strings
use MM
(months) instead of mm
(minutes) :
DateTime.Now.ToString("dd/MM/yyyy");
check here for more format options.
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