format date in tostring c# code example
Example 1: csharp datetime string format
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
Example 2: C# datetime.now to string only numbers
DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive