posts - 325,  comments - 25,  trackbacks - 0

           //取系統日期
              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;
              }

              //取系統日期
              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;
              }

              //取系統日期
              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;
              }

              //取系統日期
              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 長春語林科技 閱讀(7657) 評論(0)  編輯  收藏 所屬分類: java
          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 安平县| 南部县| 苏尼特右旗| 丰原市| 大厂| 仁化县| 新平| 夏邑县| 日喀则市| 汪清县| 开化县| 峨山| 卓尼县| 会昌县| 桐城市| 正镶白旗| 丰县| 正阳县| 甘南县| 嘉兴市| 宿松县| 环江| 富宁县| 鄂州市| 江源县| 河北区| 博白县| 嘉定区| 墨竹工卡县| 永平县| 凤阳县| 沙田区| 枣阳市| 绥德县| 崇义县| 沾益县| 福州市| 岳阳市| 梓潼县| 神木县| 靖远县|