I know this is an old post with many answers, but I haven't seen this way of removing the time portion. Suppose you have a DateTime
variable called myDate
, with the date with time part. You can create a new DateTime
object from it, without the time part, using this constructor:
public DateTime(int year, int month, int day);
Like this:
myDate = new DateTime(myDate.Year, myDate.Month, myDate.Day);
This way you create a new DateTime
object based on the old one, with 00:00:00 as time part.