Skip to content

Commit 0ae31cd

Browse files
committed
🐛 🎉 💄
1 parent 5a87c77 commit 0ae31cd

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

toolTest/joda-time/src/test/java/UnitTest.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import com.google.common.collect.Sets;
2-
import org.joda.time.DateTime;
3-
import org.joda.time.Days;
4-
import org.joda.time.LocalDate;
5-
import org.joda.time.LocalDateTime;
2+
import org.joda.time.*;
63
import org.joda.time.format.DateTimeFormat;
74
import org.junit.jupiter.api.Test;
85

@@ -15,6 +12,26 @@
1512
*/
1613
public class UnitTest {
1714

15+
16+
@Test void t7() {
17+
18+
19+
Period days = Period.days(2);
20+
21+
LocalDate localDate = LocalDate.now().plus(days);
22+
System.out.println(localDate);
23+
24+
25+
DateTime start = new DateTime("2023-10-01");
26+
DateTime end = new DateTime("2023-10-05");
27+
28+
// 计算两个日期的差值(返回 Period 对象)
29+
Period diff = new Period(start, end);
30+
System.out.println(diff.getDays());
31+
32+
}
33+
34+
1835
@Test void t6(){
1936
DateTime now = DateTime.now();
2037
// int year,

0 commit comments

Comments
 (0)