我需要从Date对象获取“Day of day”。我试图将Date对象中的Day编号解析为new SimpleDateFormat("u").format(date)
。
根据SimpleDateFormat u : Day number of week (1 = Monday, ..., 7 = Sunday)
这是例外情况
答案 0 :(得分:0)
试试这个以获取约会的日期......
Calendar c = Calendar.getInstance();
c.setTime(yourDate);//Replace your date with the date which u have
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
答案 1 :(得分:0)
使用此
Calendar c = Calendar.getInstance(); //create an instance of Calendar class
int Day = c.get(Calendar.DAY_OF_WEEK); //get current day of the week from the same instance