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

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 化隆| 南和县| 阜南县| 旅游| 合水县| 习水县| 上饶县| 宝兴县| 大安市| 遂宁市| 安龙县| 桃园县| 宝清县| 七台河市| 阜南县| 定陶县| 瑞安市| 福建省| 凌海市| 朝阳县| 酒泉市| 开封市| 嘉善县| 分宜县| 邳州市| 得荣县| 武城县| 平陆县| 德庆县| 乌兰察布市| 和硕县| 莱西市| 拉孜县| 郯城县| 涿鹿县| 扬州市| 定远县| 韶关市| 福泉市| 锦屏县| 江北区|