I have a Time column in a DataBase table. The date is not important, we just want a time in the day. What type would be best to represent it in C#? I was going to use a DateTime, but I don't like the idea of having a date.
Any idea?
Thanks!
I have a Time column in a DataBase table. The date is not important, we just want a time in the day. What type would be best to represent it in C#? I was going to use a DateTime, but I don't like the idea of having a date.
Any idea?
Thanks!
Jon Skeet's been working on something called Noda Time, maybe this will help:
You could try something like this
TimeSpan ts = DateTime.Now.TimeOfDay
Where you are applying the time property of the DateTime object and just use that.
I would use a TimeSpan to represent this, with the TimeSpan being the span of time since midnight. This correlates to DateTime's TimeOfDay property in the framework.