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

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 张北县| 锡林浩特市| 县级市| 阳高县| 咸丰县| 宣化县| 固阳县| 宁德市| 健康| 高碑店市| 康平县| 常州市| 沈阳市| 彩票| 南川市| 揭阳市| 潍坊市| 太仆寺旗| 方正县| 延长县| 即墨市| 楚雄市| 桂阳县| 香河县| 鄂州市| 江安县| 临猗县| 武义县| 盈江县| 泾川县| 新建县| 高雄市| 平遥县| 上蔡县| 民乐县| 九龙城区| 荃湾区| 米脂县| 嘉黎县| 那坡县| 柘荣县|