Skip to content

Commit e5b315a

Browse files
committed
update
1 parent a20ce7f commit e5b315a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/test/java/cn/com/ttblog/ssmbootstrap_table/TestJodaTime.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@
66

77
import org.joda.time.DateTime;
88
import org.joda.time.DateTimeUtils;
9+
import org.joda.time.LocalDate;
10+
import org.joda.time.LocalTime;
911
import org.junit.Ignore;
1012
import org.junit.Test;
1113
import org.slf4j.Logger;
1214
import org.slf4j.LoggerFactory;
1315

1416
import cn.com.ttblog.ssmbootstrap_table.util.JodaTimeUtil;
1517

18+
/**
19+
* LocalDate - date without time
20+
LocalTime - time without date
21+
Instant - an instantaneous point on the time-line
22+
DateTime - full date and time with time-zone
23+
DateTimeZone - a better time-zone
24+
Duration and Period - amounts of time
25+
Interval - the time between two instants
26+
A comprehensive and flexible formatter-parser
27+
*/
1628
//@Ignore
1729
public class TestJodaTime {
1830
Logger log = LoggerFactory.getLogger(this.getClass());
@@ -121,4 +133,22 @@ public void parse(){
121133
public void getTimeStamp(){
122134
System.out.println("timestamp:"+System.currentTimeMillis());
123135
}
136+
137+
@Test
138+
public void test() {
139+
LocalDate localDate = new LocalDate();
140+
System.out.println("localDate:" + localDate);
141+
System.out.println("localDate.toDate():" + localDate.toDate());
142+
LocalTime localTime=new LocalTime();
143+
System.out.println("localTime:"+localTime);
144+
System.out.println("localTime.toDateTimeToday():"+localTime.toDateTimeToday());
145+
LocalTime minTime=new LocalTime(0,0,0,0);
146+
LocalTime maxTime=new LocalTime(23,59,59,59);
147+
System.out.println("maxTime:"+maxTime);
148+
System.out.println("maxTime:"+maxTime.toDateTimeToday());
149+
System.out.println("昨天的时间从:"+minTime.toDateTimeToday().plusDays(-1)+"到:"+maxTime.toDateTimeToday().plusDays(-1));
150+
DateTime d1=new DateTime();
151+
DateTime d2=new DateTime().plusMinutes(2);
152+
System.out.println("d2.compareTo(d1):"+d2.compareTo(d1));
153+
}
124154
}

0 commit comments

Comments
 (0)