static String timeString(Date createTime){
long timeLong = createTime.getTime() / 1000;
long timeDifference = ((new Date()).getTime() / 1000) - timeLong;
if (timeDifference >= 0 && timeDifference < 60 * 60){
Long returnTime = timeDifference / 60;
if (returnTime == 0){
return "刚刚上传";
}
return returnTime + "分钟前上传";
}
if (timeDifference >= 60 * 60 && timeDifference < 60 * 60 * 24 ){
long returnTime = timeDifference / (60 * 60);
return returnTime + "小时前上传";
}
if (timeDifference >= 60 * 60 * 24 && timeDifference < 60 * 60 * 24 * 7){
long returnTime = timeDifference / (60 * 60 * 24);
return returnTime + "天前上传";
}
if (timeDifference >= 60 * 60 * 24 * 7 && timeDifference < 60 * 60 * 24 * 30){
long returnTime = timeDifference / (60 * 60 * 24 * 7);
return returnTime + "周前上传";
}
if (timeDifference >= 60 * 60 * 24 * 30 && timeDifference < 60 * 60 * 24 * 365){
long returnTime = timeDifference / (60 * 60 * 24 * 30);
if (returnTime == 12){
return "11月前上传";
}
return returnTime + "月前上传";
}
if (timeDifference >= 60 * 60 * 24 * 365){
long returnTime = timeDifference / (60 * 60 * 24 * 365);
return returnTime + "年前上传";
}
return "";
}