posts - 325,  comments - 25,  trackbacks - 0

           //取系統(tǒng)日期
              public String getDateWithString() {
                  Calendar now = Calendar.getInstance();
                  int month = now.get(Calendar.MONTH) + 1;
                  int day = now.get(Calendar.DAY_OF_MONTH);
                  int year = now.get(Calendar.YEAR);
                  String result = year + " 年 " + month + " 月 " + day + " 日 ";
                  return result;
              }

              //取系統(tǒng)日期
              public String getDateWithYMD() {
                  Calendar now = Calendar.getInstance();
                  int month = now.get(Calendar.MONTH) + 1;
                  int day = now.get(Calendar.DAY_OF_MONTH);
                  int year = now.get(Calendar.YEAR);
                  String date = year + "-" + month + "-" + day;
                  return date;
              }

              //取系統(tǒng)日期
              public String getDateWithNum() {
                  Calendar now = Calendar.getInstance();
                  int year = now.get(Calendar.YEAR);
                  int month = now.get(Calendar.MONTH) + 1;
                  int day = now.get(Calendar.DAY_OF_MONTH);
                  String smonth = "" + month;
                  String sday = "" + day;
                  if (month < 10) {
                      smonth = "0" + month;
                  }
                  if (day < 10) {
                      sday = "0" + day;
                  }
                  String date = year + smonth + sday;
                  return date;
              }

              //取系統(tǒng)日期
              public Date getDate() {
                  Calendar now = Calendar.getInstance();
                  int month = now.get(Calendar.MONTH) + 1;
                  int day = now.get(Calendar.DAY_OF_MONTH);
                  int year = now.get(Calendar.YEAR);
                  String date = year + "-" + month + "-" + day;
                  Date result = Date.valueOf(date);
                  return result;
              }

          posted on 2008-08-27 23:51 長(zhǎng)春語林科技 閱讀(7657) 評(píng)論(0)  編輯  收藏 所屬分類: java
          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

           

          長(zhǎng)春語林科技?xì)g迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 定结县| 望都县| 贺州市| 徐水县| 土默特右旗| 自治县| 昆明市| 鹤山市| 永康市| 青田县| 界首市| 台前县| 怀安县| 个旧市| 繁昌县| 游戏| 凯里市| 治多县| 银川市| 湖北省| 姚安县| 长乐市| 河津市| 潜江市| 兴文县| 伊通| 宣化县| 禹城市| 茶陵县| 衡山县| 泸水县| 黄浦区| 玉溪市| 建水县| 铜山县| 乐昌市| 通许县| 大田县| 平顶山市| 青冈县| 菏泽市|