On Thu, 28 Jun 2007 12:55:44 -0700, lucius <lu****@newsgroup.nospamwrote:
I have a List of DateTimes that look like this
{1753-01-01 16:00:00}
{1753-01-01 22:00:00}
And I would like to do something in my WinForm/CommandLine app that
does MyMethod() every day at 16:00 and 22:00, basically ignoring the
date and just doing something based on the time. What is the best way
to implement that?
Hmmm...this looks related to your post that I just replied to in the
..framework newsgroup. :)
If you don't care about the date, don't store the date. Don't use a data
structure that is intended to represent absolute points in time. Of
course, it goes without saying that based on this new information, my
other reply may not be relevant, since I had assumed that since you were
storing a date, you actually cared about the date.
I would use the TimeSpan struct instead, interpreting it as an offset from
midnight. So, a value of 0 would be midnight, a value of 12 hours would
be noon, etc. You would never have a TimeSpan greater than or equal to 24
hours, but that's fine. That's no different than using an int to store a
value that is never larger than (for example) 1000.
Pete