how to get only date list in c#

Feb 4 2018 11:40 PM
how to get only date list in c#(02/05/2018)
 
var sdatenew = DateTime.Now.ToString("MM/dd/yyyy");
var endDates1 = DateTime.Parse(sdatenew).AddDays(6).ToString("MM/dd/yyyy"); 
List<DateTime> rangeSs = Enumerable.Range(0, (DateTime.Parse(endDates1) - DateTime.Parse(sdatenew)).Days + 1)
.Select(i =>Convert.ToDateTime(sdatenew).AddDays(i))
.ToList();
 
this list iam getting date with time i need only date(mm/dd.yyyy)

Answers (3)