我尝试使用以下代码将日期作为字符串。但它返回错误的字符串。我可以用这段代码修复它吗?
private String getDayOfWeek(int value){
String day = "";
switch(value){
case 1:
day="Sunday";
break;
case 2:
day="Monday";
break;
case 3:
day="Tuesday";
break;
case 4:
day="Wednesday";
break;
case 5:
day="Thursday";
break;
case 6:
day="Friday";
break;
case 7:
day="Saturday";
break;
}
return day;
我将其实现为
Calendar c = Calendar.getInstance();
String dayOfWeek = getDayOfWeek(Calendar.DAY_OF_WEEK);
System.out.println(dayOfWeek);