c# change date format to yyyy-mm-dd code example
Example 1: c# date to string yyyy-mm-dd
var date_string = date.ToString("yyyy-MM-dd");
Example 2: Convert a date to yyyy mm dd format
const formatYmd = date => date.toISOString().slice(0, 10);
formatYmd(new Date());