隨筆 - 24  文章 - 0  trackbacks - 0
          <2011年12月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          public class Test {

           /**
            * @param args
            * @throws java.text.ParseException
            */

           public static void main(String[] args) throws java.text.ParseException {
            // Date dateNow = new Date();
            //
            // String dateNowStr = dateFormat.format(dateNow);
            // System.out.println(dateNowStr);

            final String dayNames[] = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五",
              "星期六" };
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");

            Calendar calendar = Calendar.getInstance();
            Date date = new Date();
            String datarq = dateFormat.format(date); //日期
            
            calendar.setTime(date);
            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
            if (dayOfWeek < 0)
             dayOfWeek = 0;

            System.out.println(datarq + "  " + dayNames[dayOfWeek]);

           }

          }

          posted @ 2011-12-22 15:07 馮占科 閱讀(145) | 評論 (0)編輯 收藏
          主站蜘蛛池模板: 三门峡市| 察哈| 江孜县| 杨浦区| 贵港市| 山西省| 兴业县| 静乐县| 龙山县| 犍为县| 鸡泽县| 高密市| 资兴市| 陆丰市| 阿拉尔市| 卢龙县| 鸡西市| 仙居县| 夏邑县| 苏州市| 大庆市| 志丹县| 平罗县| 昭平县| 漠河县| 东乌| 遂川县| 旅游| 湘潭市| 皮山县| 濮阳县| 隆化县| 通城县| 姚安县| 临朐县| 汝阳县| 蒙阴县| 洛阳市| 方城县| 蒙山县| 永仁县|