What's JAVA ?

          發現在我走近java之后,感覺自己什么都不會了!
          posts - 13, comments - 7, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理
           1 /*計算兩個任意日期間的相差的天數(自然天) */
           2 
           3   public int computeCoolingOffPeriod(String sBeginDate,String sEndDate) throws Exception{
           4     Calendar calendar1=Calendar.getInstance();;
           5     Calendar calendar2=Calendar.getInstance();;
           6     SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd");//格式很重要:是20051031,還是2005-10-31格式呢?
           7     if (sBeginDate.equals("0")) {System.out.println("sBirthDate.equals====0");   sBeginDate = "19000101";     }
           8 
           9     calendar1.setTime(formatter1.parse(sBeginDate));
          10     calendar2.setTime(formatter1.parse(sEndDate));
          11 
          12     return  (int)( (calendar2.getTimeInMillis()-calendar1.getTimeInMillis())/1000/60/60/24 );//獲取天數的差值。
          13 
          14     
          15   }
          16 

          只有注冊用戶登錄后才能發表評論。


          網站導航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          主站蜘蛛池模板: 阳曲县| 绩溪县| 贡山| 巨野县| 新宾| 汝阳县| 道孚县| 淅川县| 嵊泗县| 新营市| 甘泉县| 福建省| 兴城市| 沙河市| 南充市| 孝义市| 马公市| 新余市| 河北区| 淅川县| 酒泉市| 固始县| 如皋市| 年辖:市辖区| 景德镇市| 香港| 大渡口区| 博野县| 吉林市| 德惠市| 砀山县| 鱼台县| 大新县| 犍为县| 宁明县| 连城县| 延吉市| 栾城县| 赤水市| 钟祥市| 诏安县|