依赖
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.10</version>
</dependency>
用法
```
@Test
public void testdatetime() {
long enterTime = 1656671978000L
DateTime start = new DateTime(enterTime)
DateTime end = new DateTime(System.currentTimeMillis())
// 获得今天是当月的第几天
int startMonth = start.getDayOfMonth()
int endMonth = end.getDayOfMonth()
// 此时此刻的DateTime
DateTime nowTime = new DateTime()
int currentMonthDay = new DateTime().plusMonths(1).withDayOfMonth(1).minusDays(1).getDayOfMonth()
// 下个月的这一天
DateTime nextDate = new DateTime().plusMonths(1)
// 下下个月的这一天
DateTime nextDate2 = new DateTime().plusMonths(2)
// 设置成当月的第一天
DateTime nextDate3 = nextDate2.withDayOfMonth(1)
// 设置成当月的第二天
DateTime nextDate4 = nextDate2.withDayOfMonth(2)
// 当年的第几个月
int monthOfYear = nextDate4.getMonthOfYear()
System.out.println(start.toString()+end.toString())
}
```