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++博客   博問  
           
          主站蜘蛛池模板: 固阳县| 柘城县| 德兴市| 天等县| 新丰县| 三穗县| 务川| 沽源县| 昌江| 景泰县| 盱眙县| 焦作市| 大方县| 冷水江市| 阿坝县| 邹平县| 苏尼特左旗| 云安县| 昌邑市| 灌南县| 澳门| 宜昌市| 阳信县| 香港 | 嵊州市| 黄石市| 肃北| 灵川县| 旅游| 永新县| 理塘县| 景宁| 平原县| 兴义市| 墨竹工卡县| 临武县| 咸宁市| 衡山县| 金乡县| 武陟县| 红安县|