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 冯占科 阅读(141) |
评论 (0) |
编辑 收藏