如何设置DateTimeFormat以显示如下内容: “周三阳光”。 “周一的太阳。” “周一的太阳。” “周一的太阳。” “周一周二”
DateTimeFormat dtfDate = DateTimeFormat.getFormat("dd.MM");
if (rt.detalization.equals("date")) {
dtfDate = DateTimeFormat.getFormat("dd.MM");
}
if (rt.detalization.equals("week")) {
dtfDate = DateTimeFormat.getFormat("EEE.dd-EEE.dd");
//how can show week from choisen day to sunday like I wrote before
}
if (rt.detalization.equals("month")) {
dtfDate = DateTimeFormat.getFormat("MMM");
}
答案 0 :(得分:0)
以下代码打印
DateTimeFormat format2 = DateTimeFormat.getFormat("E");
String format = format2.format(new Date());
System.out.println(format); //prints "Mon"
所以
if (rt.detalization.equals("week")) {
DateTimeFormat format2 = DateTimeFormat.getFormat("E");
String day= format2.format(dtfDate);
System.out.println(day+"-Sun");
}