In C# I need to compare the value of DateTime.Today
/6pm, to a field that stores the Created DateTime
.
Basically there is certain functionality that is only accessible on the same day as the created day and then only till 6pm.
The part I am not fully understanding is how to accurately represent 6pm on Today to compare against. Is there a method that always returns, say, Midnight that I can then do a .AddHours(18);
to?
Am I over-complicating this? Thanks.
DateTime SixPmToday = DateTime.Now.Date.AddHours(18);
If you output this, say to console, you will have (in my regional settings):
5/24/2010 6:00:00 PM
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