DateTime.Today.ToString("dd/mm/yyyy") returns invalid DateTime Value

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.


It should be MM for months. You are asking for minutes.

DateTime.Now.ToString("dd/MM/yyyy");

See Custom Date and Time Format Strings on MSDN for details.

Tags:

C#

Datetime