posts - 14,  comments - 37,  trackbacks - 0
          java的日期比較方法(精確到秒):
          public boolean compDate(String s1,String s2){
                  
          int day=0
                  SimpleDateFormat sf
          =new SimpleDateFormat("yyyy-MM-dd");
                  GregorianCalendar calendar1
          =new GregorianCalendar();
                  GregorianCalendar calendar2
          =new GregorianCalendar();
                  
          //String s1="2006-04-21";
                  
          //String s2="2006-04-25";
                  Date xxx1=new Date();
                  Date xxx2
          =new Date();
                  
          try {
                      xxx1
          =sf.parse(s1);
                      xxx2
          =sf.parse(s2);
                      day 
          = (int) ((xxx2.getTime() - xxx1.getTime()) / 3600 / 24 / 1000);
                  }
           catch (ParseException e) {
                      
          // TODO Auto-generated catch block
                      e.printStackTrace();
                  }

                  
          if(day>10){
                      
          return true;
                  }
          else{
                      
          return false;
                  }

                  }
           
          posted on 2007-07-11 13:06 冰封的愛 閱讀(3298) 評論(0)  編輯  收藏 所屬分類: 常用工具
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(3)

          隨筆檔案

          文章分類

          文章檔案

          相冊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 安康市| 吉安县| 敖汉旗| 泽库县| 龙山县| 土默特左旗| 松潘县| 清流县| 汕头市| 邻水| 宝山区| 福安市| 普陀区| 长海县| 鄂尔多斯市| 吴旗县| 江北区| 吉首市| 池州市| 页游| 佛教| 甘孜县| 林口县| 宝鸡市| 四会市| 伊金霍洛旗| 贡嘎县| 金寨县| 乐至县| 晋城| 岗巴县| 库伦旗| 精河县| 常宁市| 凤山市| 临夏县| 密山市| 泉州市| 唐河县| 郴州市| 凤凰县|