Error in date_time example -- exp-print_month.html
There are two errors in the date_time/doc/exp-print_month.html example. std::cout<<"Enter Year: "; int should be std::cout << "Enter Year: "; int year,month; and //Use the calendar to get the last day of the month int eom_day = gregorian_calendar::end_of_month_day( should be int eom_day = gregorian_calendar::end_of_month_day(year,month);
I have a question about usage. Say i have a date such as using namespace boost::gregorian; date vl_Date_date(2002, Feb, 03); I would like to define a date_period such that the date is within that period. But further I would like this period to cover exactly the month in which the date exists. I had a look at some of the examples etc but could not see a stright forward way of doing this. Is it just me? Also, if i have a date_period object, how do i find out the duration of the period? Thanks for any help, Martin.
I have a question about usage. Say i have a date such as
using namespace boost::gregorian; date vl_Date_date(2002, Feb, 03);
I would like to define a date_period such that the date is within that period. But further I would like this period to cover exactly the month in which the date exists. I had a look at some of the examples etc but could not see a stright forward way of doing this. Is it just me?
I haven't compiled this, but something like this should work: greg_year year = v1_Date_date.year(); greg_month month = v1_Data_data.month(); greg_day end_of_month = gregorian_calendar::end_of_month_day(year,month) date_period dp(date(year, month,1), date(year, month, end_of_month));
Also, if i have a date_period object, how do i find out the duration of the period?
Hmm, this function should probably be added to the period class. In the meantime this should work: date_duration dd = dp.end() - dp.begin(); Jeff
participants (3)
-
David Clark
-
Jeff Garland
-
Martin