Algorithm to add or subtract days from a date?

后端 未结 10 1216
野的像风
野的像风 2020-12-01 14:10

I\'m trying to write a Date class in an attempt to learn C++.

I\'m trying to find an algorithm to add or subtract days to a date, where Day starts from 1 and Month s

10条回答
  •  隐瞒了意图╮
    2020-12-01 15:05

    One approach is to map the date to the Julian number of the date, do your integer operations and then transform back.

    You will find plenty of resources for the julian functions.

提交回复
热议问题