Does the original poster want to ask how to calculate the year, month and day conveniently?
Recommend a java date library: http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTime.html
Just keep calling functions like plusDays, minusDays. It's very convenient. You don't need to deal with various boundary conditions such as leap year or normal year, 30 days or 31 days.
Does the original poster want to ask how to calculate the year, month and day conveniently?
Recommend a java date library: http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTime.html
Just keep calling functions like
plusDays, minusDays
. It's very convenient. You don't need to deal with various boundary conditions such as leap year or normal year, 30 days or 31 days.I did it myself. . It turns out it’s not that difficult
Just write a tool class