How to convert the current date to formatted string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        DateTime now = DateTime.Now;

        string s = now.ToString("dd/MM/yyyy HH:mm:ss");
        Console.WriteLine(s);
        
    }
}





/*
run:

11/09/2020 09:05:22

*/

 



answered Sep 11, 2020 by avibootz

Related questions

1 answer 221 views
1 answer 230 views
10 answers 986 views
986 views asked Feb 18, 2015 by avibootz
1 answer 195 views
...