得到某一天是星期幾
//獲取yyyy-MM-dd是星期幾public static int getWeekdayOfDateTime(String datetime){
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
try {
c.setTime(df.parse(datetime));
} catch (Exception e) {
e.printStackTrace();
}
int weekday = c.get(Calendar.DAY_OF_WEEK)-1;
return weekday;
}
posted on 2007-06-26 13:25 付軒 閱讀(2638) 評(píng)論(0) 編輯 收藏