easy way to add 1 month to a time_t in C/C++

后端 未结 4 1559
小蘑菇
小蘑菇 2021-01-13 01:51

I have some code that uses the Oracle function add_months to increment a Date by X number of months.

I now need to re-implement the same logic in a C / C++ function.

4条回答
  •  抹茶落季
    2021-01-13 02:28

    You can use Boost.GregorianDate for this.

    More specifically, determine the month by adding the correct date_duration, and then use end_of_month_day() from the date algorithms

提交回复
热议问题