You can't derive from DateTime because it's a struct.
As for creating your own date type - you just do it as you would any
other type. I'd think very carefully whether you really need to before
starting though - date and time handling is notoriously difficult.
What do you want to do that DateTime, DateTimeOffset from 2.0SP1, and
TimeZoneInfo from 3.5 don't do for you?
The problem is that in my old application datetime was
Char 8 fields. If the date isn't set date field is empty.
So i must often convert from datetime to string and
from string to nullable<datetime> and it's killing
me. I would like to write my own datetime that
would accept string values and "unset" value and
allow comparings...
The problem is that in my old application datetime was
Char 8 fields. If the date isn't set date field is empty.
So i must often convert from datetime to string and
from string to nullable<datetime> and it's killing
me. I would like to write my own datetime that
would accept string values and "unset" value and
allow comparings...
Sounds like you should be writing a wrapper around DateTime (or
DateTimeOffset) rather than writing your own full-blown date/time
handling. Doing that shouldn't be too hard.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.