I’m trying to store a shortened date (mm/dd/yyyy) into a DateTime object. The following code below is what I am currently trying to do; this includes the time (12:00:00 AM) which I do not want 🙁
DateTime goodDateHolder = Convert.ToDateTime(DateTime.Now.ToShortDateString());
Result will be 10/19/2009 12:00:00 AM
DateTimeis an integer interpreted to represent both parts of DateTime (ie: date and time). You will always have both date and time inDateTime. Sorry, there’s nothing you can do about it.You can use .Date to get the date part. In these cases, the time will always be 12:00 but you can just ignore that part if you don’t want it.