date_duartion <-> months

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

date_duartion <-> months

Oliver.Kowalke-2
Hello,
how can I extract the months from a date_duration?
Thx,
Oliver

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: date_duartion <-> months

Leif Gruenwoldt
Try number_of_months()


On 1/16/06, [hidden email] <[hidden email]> wrote:

> Hello,
> how can I extract the months from a date_duration?
> Thx,
> Oliver
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


--
Leif Gruenwoldt

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: date_duartion <-> months

Jeff Garland
In reply to this post by Oliver.Kowalke-2
On Mon, 16 Jan 2006 08:26:56 +0100, Oliver.Kowalke wrote
> Hello,
> how can I extract the months from a date_duration?

There isn't a way.  date_duration is just a count of days.  A month is a
logical concept of variable length (28, 30, 31, etc)  So there's really no way
to go from 300 days to ??? months -- it depends on the context.  This leads to
all kinds of problems including the reversiblity of operations issues:
http://www.boost.org/doc/html/date_time/gregorian.html#snap_to_details

Weeks, on the other hand, is 'no problem' since a week is always 7 days.

Jeff
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users