Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a standard way of representing uncertain dates in C#?

Tags:

I'm playing around with some historical data wherein some dates I know accurately (i.e. dd/mm/yyyy) whilst others are just yyyy and others are yyyy? (i.e. the year is uncertain). I've even come across fl, which apparently means "flourished".

At the moment I'm using the DateTime class which doesn't seem to support the flagging/representation of such uncertainty. Is there a standard way of addressing this problem?

like image 923
Ian Hopkinson Avatar asked Mar 06 '10 19:03

Ian Hopkinson


1 Answers

I would consider creating a class that wraps a DateTime (or DateTimeOffset) and has additional fields to represent which portions of the date are certain and which are not.

You could then expose month, day, and year fields as nullable values to reflect which portions of the date are known.

like image 199
LBushkin Avatar answered Sep 29 '22 18:09

LBushkin