码迷,mamicode.com
首页 > 其他好文 > 详细

一段有趣的代码

时间:2017-07-06 15:09:11      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:junit   oid   log   warning   iss   sys   mis   class   code   

 1 import java.text.SimpleDateFormat;
 2 import java.util.Date;
 3 
 4 import org.junit.Test;
 5 
 6 public class IMISSYOU {
 7     @SuppressWarnings("deprecation")
 8     @Test
 9     public void OurTime(){
10         Date IMEETYOU = new Date(2016, 9, 30) ;
11         Date IMISSYOU = new Date(2017,4,10);
12         Date IMissYOU = new Date(2017,6,6);
13         
14         SimpleDateFormat sf = new SimpleDateFormat("yy-MM-dd");
15         
16         long TIMETWO = countDay(IMissYOU,IMEETYOU);
17         
18         System.out.println("IMEETYOU : "+sf.format(IMEETYOU));
19         System.out.println("IMISSYOU : "+sf.format(IMISSYOU));
20         System.out.println("IMissYOU : "+TIMETWO+" DAY");
21     }
22     
23     public long countDay(Date time1,Date time2){
24         long day=(time1.getTime()-time2.getTime())/(1000 * 60 * 60 * 24);
25         return day;
26     }
27 }

 

一段有趣的代码

标签:junit   oid   log   warning   iss   sys   mis   class   code   

原文地址:http://www.cnblogs.com/iwilwaityouforever/p/7126218.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!