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

前端 未结 4 1210
说谎
说谎 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:34

    I was just asking the same question (which is how I found this page) and someone at my work place (well done, DCK) came up with a suggestion:

    The date selectors on many smart phones (and other similar interfaces) will "roll" the day from the 31st to the 1st without altering the month, similarly for the month field.

    I can't think of another use ATM and this one could be implemented in other ways, but at least it's an example!

    Tim

提交回复
热议问题