You have to use ToString() to format your string
string dateonly = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
but if you convert it again into date time "Convert.ToDateTime(dateonly)" then it will be converted into slandered date time format again
Hope this will solve your peoblem