How to?

  • Thread starter Thread starter Jacek Jurkowski
  • Start date Start date
Oveerride DateTime or write my own date Type?

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?

Jon
 
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.

Jon
 

Ask a Question

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.

Ask a Question

Similar Threads

Parsing DateTime 10
How to... 1
Nullable 3
is there the opposite of datetime.FromOADate? 4
Count 4
NHibernate QueryOver with Many-to-Many 0
Expand Range into List 2
SqlDateTime and DateTime 2

Back
Top