File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
toolTest/joda-time/src/test/java Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 11import 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 .*;
63import org .joda .time .format .DateTimeFormat ;
74import org .junit .jupiter .api .Test ;
85
1512 */
1613public 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,
You can’t perform that action at this time.
0 commit comments