Convert "date and time" to "date" in C #

0

I need to convert "date and time" to "date" in C #, keeping DateTime format (without converting to string).

In the code, I'm converting an object to datetime, but I need to remove the time for it as well to display it in a DataGridTextColumn .

t.DataDeContrato = Convert.ToDateTime(row.ItemArray[6]);
    
asked by anonymous 07.11.2017 / 18:04

1 answer

2

DateTime has a property called Date .

t.DataDeContrato = Convert.ToDateTime(row.ItemArray[6]).Date;
    
07.11.2017 / 18:05