如何将分钟转换为天,小时,分钟
如何在java中将分钟转换为天小时和分钟(我们在这里有一个星期,7天)
public String timeConvert(int time){
String t = "";
int h = 00;
int m = 00;
// h= (int) (time / 60);
// m = (int) (time % 60);
// if(h>=24) h=00;
if((time>=0) && (time<=24*60)){
h= (int) (time / 60);
m = (int) (time % 60);
}else if((time>24*60) && (time<=24*60*2)){
h= (int) (time / (1440));
m = (int) (time % (1440));
}else if((time>24*60*2) && (time<=24*60*3)){
h= (int) (time / (2880));
m = (int) (time % (2880));
}else if((time>24*60*3) && (time<=24*60*4)){
h= (int) (time / (2880*2));
m = (int) (time % (2880*2));
}else if((time>24*60*4) && (time<=24*60*5)){
h= (int) (time / (2880*3));
m = (int) (time % (2880*3));
}else if((time>24*60*5) && (time<=24*60*6)){
h= (int) (time / (2880*4));
m = (int) (time % (2880*4));
}else if((time>24*60*6) && (time<=24*60*7)){
h= (int) (time / (2880*5));
m = (int) (time % (2880*5));
}
t =h+":"+m ;
return t;
}
我试过这个,但它不起作用
谢谢