Sample code is given below. Make sure MM is in capital letters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
using System; namespace Hello_World { class Program { static void Main(string[] args) { DateTime today = DateTime.Now; string dt = today.ToString("dd/MM/yyyy"); Console.WriteLine(dt); } } } ; |