1.sql处理(postgersql)
case when A = 0 or B is null
then array_to_string(startTime, ':')
else case
when char_length(
CAST( (startTime [1] ::integer) + floor( ( (startTime [2] ::integer) + round(B / A)) / 60) as VARCHAR)) > 2
then concat( ( (startTime [1] ::integer) + floor( ( (startTime [2] ::integer) + round(B / A)) / 60)) , ':', lpad( cast( COALESCE( mod( (startTime [2] ::integer) + round(B / A), 60) , 00) as VARCHAR) , 2, '0'))
else concat( lpad( CAST( COALESCE( (startTime [1] ::integer) + floor( ( (startTime [2] ::integer) + round(B / A)) / 60) , 00) as VARCHAR) , 2, '0') , ':', lpad( cast( COALESCE( mod( (startTime [2] ::integer) + round(B / A), 60) , 00) as VARCHAR) , 2, '0'))
end
end as endTime
2.java代码处理
function timeFormat(numStr) {
if (numStr == undefined || numStr.length == 0) return '';
if (numStr == '0'){
return '0';
}else{
if(numStr%60<10){
return parseInt(numStr/60)+":0"+numStr%60;
}else{
return parseInt(numStr/60)+":"+numStr%60;
}
}
}