登录签名认证 专题列表开服时间格式更改  收藏优化

This commit is contained in:
kehaoyuan
2017-08-10 10:20:35 +08:00
parent 49f4ba2da8
commit 3c5871526d
16 changed files with 216 additions and 41 deletions

View File

@ -99,23 +99,21 @@ public class GameViewUtils {
try {
long today = format.parse(format.format(new Date())).getTime();
long day = Long.parseLong(testTime + "000");
Calendar calendar = Calendar.getInstance(TimeZone
.getTimeZone("Asia/Shanghai"));
calendar.setTimeInMillis(day);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm", Locale.CHINA);
String time = timeFormat.format(day);
if (day >= today && day < today + 86400 * 1000) {
testDate = "今天" + hour + "";
testDate = "今天 " + time;
} else if (day >= today + 86400 * 1000
&& day < today + 86400 * 1000 * 2) {
testDate = "明天" + hour + "";
testDate = "明天 " + time;
} else if (day >= today + 86400 * 1000 * 2
&& day < today + 86400 * 1000 * 3) {
testDate = "后天" + hour + "";
testDate = "后天 " + time;
} else if (day >= today - 86400 * 1000 && day < today) {
testDate = "昨天" + hour + "";
testDate = "昨天 " + time;
} else {
format = new SimpleDateFormat("MM-dd", Locale.CHINA);
testDate = format.format(day) + " " + hour + "";
testDate = new SimpleDateFormat("MM-dd HH:mm", Locale.CHINA).format(day);
}
return testDate;
} catch (ParseException e) {