jimphei學習工作室

          jimphei學習工作室

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            23 隨筆 :: 0 文章 :: 1 評論 :: 0 Trackbacks

          java獲得指定時間幾天前或幾天后的日期

          [ At 2008-9-15 By abcshadow   1 comment ]

          /**
             * 得到幾天前的時間
             * @param d
             * @param day
             * @return
             */
            public static Date getDateBefore(Date d,int day){
             Calendar now =Calendar.getInstance();
             now.setTime(d);
             now.set(Calendar.DATE,now.get(Calendar.DATE)-day);
             return now.getTime();
            }
           
            /**
             * 得到幾天后的時間
             * @param d
             * @param day
             * @return
             */
            public static Date getDateAfter(Date d,int day){
             Calendar now =Calendar.getInstance();
             now.setTime(d);
             now.set(Calendar.DATE,now.get(Calendar.DATE)+day);
             return now.getTime();
            }

          posted on 2009-06-08 14:45 jimphei 閱讀(1290) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 施甸县| 武功县| 关岭| 呼图壁县| 博兴县| 博爱县| 大庆市| 余干县| 桃园市| 江源县| 陆良县| 巴彦淖尔市| 霞浦县| 新干县| 池州市| 芦溪县| 莱西市| 成武县| 兴安盟| 晋城| 汉沽区| 延川县| 韶关市| 肇州县| 大宁县| 甘德县| 广平县| 万州区| 醴陵市| 沁水县| 丘北县| 桦甸市| 芦山县| 化德县| 会泽县| 沁水县| 洮南市| 崇义县| 四川省| 安龙县| 曲松县|