本文介紹了Calendar add() vs roll() 我們什么時候使用它?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時送ChatGPT賬號..
我知道 add()
根據(jù)日歷的規(guī)則將指定的(簽名的)時間量添加到給定的時間字段.
I know add()
adds the specified (signed) amount of time to the given time field, based on the calendar's rules.
并且roll()
在給定的時間字段上添加指定的(簽名的)單個時間單位而不改變更大的字段.
And roll()
adds the specified (signed) single unit of time on the given time field without changing larger fields.
我想不出 roll()
的日常用法,我會通過 add()
來做所有事情.
I can't think of an everyday usage of roll()
I would do everything by add()
.
你能幫我舉個例子,我們什么時候使用 roll()
以及什么時候使用 add()
?
Can you help me out with examples when do we use roll()
and when add()
?
編輯 1
Joda 答案不被接受!
推薦答案
add()
- 幾乎總是如你所說roll()
- 例如你想在一個月內(nèi)分配"事件.該算法可能會進行幾天并放置事件,然后繼續(xù)進行.到了月底,應(yīng)該從頭開始.因此roll()
.add()
- almost always, as you saidroll()
- 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. Henceroll()
.
這篇關(guān)于Calendar add() vs roll() 我們什么時候使用它?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!