c# datetime format yyyymmddhhmmss code example
Example 1: C# datetime.now to string only numbers
DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive
Example 2: c# datetime format ymd
Use DateTime.Now.ToString("yyyy-MM-dd h:mm tt");
DateTime.Now.ToString("yyyyMMddHHmmss"); // case sensitive
Use DateTime.Now.ToString("yyyy-MM-dd h:mm tt");