How to format a DateTime object as a string in C#? - Biz Tech

How to format a DateTime object as a string in C#?

Listen
 DateTime now = DateTime.Now;
string formattedDate = now.ToString("yyyy-MM-dd HH:mm:ss");
Console.WriteLine(formattedDate);