long时间类型(格林尼治)转为标准时间
格林尼治时间是从1970年1月1日,00:00:00 GMT到最后修改时间的返回值。
?
?
import java.text.SimpleDateFormat;import java.util.Date;import java.util.Locale;public class TimeUtil {private String getTimeStr(Date date) {Date today = new Date();long interval = today.getTime() - date.getTime();today.setHours(23);today.setMinutes(59);today.setSeconds(59);boolean isSameDay = (interval / 86400000) == 0 ? true : false;if (isSameDay) {if (interval < 60 * 1000) {return (interval / 1000) + "秒前";} else if (interval < 60 * 60 * 1000) {return (interval / (60 * 1000)) + "分前";} else {return (interval / (60 * 60 * 1000)) + "小时前";}} else {SimpleDateFormat dateFormat;dateFormat = new SimpleDateFormat("MM-dd hh:mm", Locale.ENGLISH);return dateFormat.format(date);}}public String getTimeStr(long date) {return getTimeStr(new Date(date * 1000));}}??