Boost.Date_Time and quarters, incomplete (or unknown) dates

Is there special support in Boost.Date_Time to support quarters, or (just) years? Consider the following scenario: I have a customer (or patient) whose (exact) date of birth is not known, only that 'he was born in 1960' or in 'May 1960' (w/o attached information on month or days). Is there another way to handle this (and preserve knowledge about the incomplete information) besides pretending that month (and perhaps even day) is 1 and storing additional flags about the information being not actually present? Best regards Christoph

Hello,
I think if this feature should be available in boost Date_Time there will be
no magic behind as well, so that the lib developer will store these flags
for you... And probably not all users will like this idea.
IMO the easiest way (if you don't care about memory usage) is to deal with
Date_Time range. From - To. If <from date> equals <to date> than this is the
birthday, otherwise, you can specify a quarter, a year, a month, etc. by
simply using the range.
With Kind Regards,
Ovanes
On 11/12/07, Christoph
Is there special support in Boost.Date_Time to support quarters, or (just) years? Consider the following scenario: I have a customer (or patient) whose (exact) date of birth is not known, only that 'he was born in 1960' or in 'May 1960' (w/o attached information on month or days).
Is there another way to handle this (and preserve knowledge about the incomplete information) besides pretending that month (and perhaps even day) is 1 and storing additional flags about the information being not actually present?
Best regards Christoph
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Christoph wrote:
Is there special support in Boost.Date_Time to support quarters, or (just) years?
There isn't anything to support quarters, but it would be pretty easy to roll your own. There is a year type called greg_year.
Consider the following scenario: I have a customer (or patient) whose (exact) date of birth is not known, only that 'he was born in 1960' or in 'May 1960' (w/o attached information on month or days).
You could combine greg_year and greg_month....it's a bit inefficient. It turns out a whipped up a month_year for someone else once, but it never got into the library. Here's what the user code looks like: month_year my1(2006, Feb); std::cout << my1 << std::endl; month_year my3 = my1 - months(2); month_year my4 = my3 - years(2); my3 -= months(1); if (my1 <= my3 ) {...} months m = my1 - my3; std::cout << "month diff: " << m.number_of_months() << std::endl; date d(2007,Feb, 22); month_year my5(d); If this is what you need, I could post it or send it to you.
Is there another way to handle this (and preserve knowledge about the incomplete information) besides pretending that month (and perhaps even day) is 1 and storing additional flags about the information being not actually present?
I've also written a time type for measurements that carried along error information with it. You could do the same thing with dates, but it's not well documented how to do this and you'd have to work out issues of what to do with arithmetic and such. But I'm afraid it's not in date-time 'out of the box'. Jeff
participants (3)
-
Christoph
-
Jeff Garland
-
Ovanes Markarian