c# datetime to string mm/dd/yyyy code example
Example 1: c# date to string yyyy-mm-dd
var date_string = date.ToString("yyyy-MM-dd");
Example 2: csharp datetime string format
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
var date_string = date.ToString("yyyy-MM-dd");
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")