How to convert specific date to formatted string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        DateTime dt = new DateTime(2020, 09, 11, 12, 08, 31);

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





/*
run:

11/09/2020 12:08:31

*/

 



answered Sep 11, 2020 by avibootz

Related questions

1 answer 213 views
1 answer 230 views
10 answers 986 views
986 views asked Feb 18, 2015 by avibootz
2 answers 445 views
...