How would I dynamically create a DateTime
object, that always has what the current month/day/year is, but always has the 16:00 time component?
You can do this:
var today = DateTime.Today.AddHours(16);
That should be whatever today is at 16:00 (4pm)
How about:
DateTime today = DateTime.Today;
DateTime Today16 = new DateTime(today.Year, today.Month, today.Day,
16, 0, 0)
That should use the year, month, day of today, and set time to 16:00 hours.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With