Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2007-07-11 14:17:45

On Wed, 11 Jul 2007 13:05:40 -0500, Martin Min wrote
> Hi, recently I found boost::date_time is a great library to work
> with for temporal work. But now I have a problem for your help with
> or input.
> It looks like the constructor of 'date' has three parameters year,
> month, day. What about if I just want to construct a Date with
> 'year'?, because this is typical in text, like "In 1991, ...".

Yep, there are 3 really isn't a 'date' without these specifics.
> Is this possilbe? If not, is there any way around this limitation?


> or even more, can I represent sth like "In the 21st century", or
> "the winter of 1998"?

There isn't a type to do this in the library, but you could certainly add your

> But now, for me it is important to represent dates like "1998",
> without any month or day mentioned.

You can use gregorian::greg_year which is the first parameter to a date. I
guess the real question is, what do you want to do with the partial data


Boost list run by bdawes at, gregod at, cpdaniel at, john at