Date formating MM/dd/yyyy 00:00:00 to yyyy-MM-dd

Convert your string to DateTime and then format it

str1=“MM/dd/yyyy 00:00:00”
tempDate = Convert.ToDateTime(str1)
tempDate.ToString(“yyyy-MM-dd”)

6 Likes