csharp date time format yyyymmdd code example
Example 1: c# date to string yyyy-mm-dd
var date_string = date.ToString("yyyy-MM-dd");
Example 2: c# datetime format ymd
Use DateTime.Now.ToString("yyyy-MM-dd h:mm tt");
var date_string = date.ToString("yyyy-MM-dd");
Use DateTime.Now.ToString("yyyy-MM-dd h:mm tt");