public static StringBuffer change(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; } } StringBuffer str = new StringBuffer(); str.append("完成充电剩余:"); if(h!=0){ str.append(h+"小时"); } if(d!=0){ str.append(d+"分钟"); } // if(s!=0){ // str.append(s+"秒"); // } return str; }
时间: 2024-10-08 14:30:21