Assign datetime value to today's date with specific time
You want DateTime.Today.AddHours(16)
DateTime.Today
will return today's date at midnight.
You can also use the Date
property to drop the time from an arbitrary DateTime
value.
I think this should do what you need...
DateTime today = DateTime.Today;
DateTime dt = new DateTime(today.Year, today.Month, today.Day, 16, 0, 0);
var anotherTime = DateTime.Today.AddHours(16.0);