Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Groovyで2つの日付の間の月と年の合計数を計算する方法
date1 =2012 nov 1 date2 =2013 feb 1
必要な出力は年 = 0、月 = 3 です。どの回答も参考になります
私はこれがすべきだと思います:
monthBetween = (start[Calendar.MONTH] - end[Calendar.MONTH]) + 1 yearsBetween = start[Calendar.YEAR] - end[Calendar.YEAR] months = monthBetween + (yearsBetween * 12)
Groovyで2つの日付間の月の差を計算するから取得