随笔 - 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 on 2011-12-22 15:07 冯占科 阅读(134) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: