我想显示我的日期在字符串中的特定日期,completedate2="2013/08/19"
如何更改此函数以从用户特定日期获取输入并返回该日期的日期。
如何使这个函数动态化只是为了接受输入和返回日,有没有办法做到这一点?
calculate date (String date)
Calendar calendar=Calendar.getInstance();
calendar.setTime(specific_date);
int weekday = calendar.get(Calendar.DAY_OF_WEEK);
return day;
String game = getdayofweek(completedate2);
private String getdayofweek(String week1) {
String dtStart = week1;
SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
try {
date1 = format.parse(dtStart);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
calender1 = new GregorianCalendar();
calender1.setTime(date1);
String[] days = new String[] {"", "SUNDAY", "MONDAY", "TUESDAY",
"WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" };
String day = days[calender1.get(Calendar.DAY_OF_WEEK)];
// String wekdays ;
// wekdays = day;
return day;
}