//时间戳转换为时间
public String convert(long mill){
Date date=new Date(mill);
String strs="";
try {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
strs=sdf.format(date);
} catch (Exception e) {
e.printStackTrace();
}
return strs;
}
<pre name="code" class="java">//秒数转换为时分秒
public static String cal(int second){
int h = 0;
int d = 0;
int s = 0;
int temp = second%3600;
if(second>3600){
h= second/3600;
if(temp!=0){
if(temp>60){
d = temp/60;
if(temp%60!=0){
s = temp%60;
}
}else{
s = temp;
}
}
}else{
d = second/60;
if(second%60!=0){
s = second%60;
}
}
return h+"时"+d+"分"+s+"秒";
}