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)春語林科技 閱讀(7651) 評(píng)論(0)  編輯  收藏 所屬分類: java
          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

           

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

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 自贡市| 贵定县| 金寨县| 兴安盟| 荃湾区| 南通市| 柘城县| 玉树县| 延安市| 竹溪县| 永新县| 宁晋县| 牙克石市| 楚雄市| 巴彦淖尔市| 福海县| 仁化县| 射阳县| 贵州省| 武清区| 阳春市| 都兰县| 宜都市| 儋州市| 棋牌| 德化县| 屯昌县| 九寨沟县| 武乡县| 鄂托克前旗| 安陆市| 连江县| 开封县| 桑植县| 安阳县| 友谊县| 乌鲁木齐县| 沧源| 通城县| 永嘉县| 哈尔滨市|