Calendar add() vs roll() when do we use it?

前端 未结 4 1201
说谎
说谎 2020-12-24 05:07

I know add() adds the specified (signed) amount of time to the given time field, based on the calendar\'s rules.

And roll() adds the specif

4条回答
  •  一向
    一向 (楼主)
    2020-12-24 05:40

    • add() - almost always, as you said
    • roll() - for example you want to "dispense" events in one month. The algorithm may be to proceed a number of days and place the event, then proceed further. When the end of the month is reached, it should start over from the beginning. Hence roll().

提交回复
热议问题