var seconds = 654332;//秒 var hours = Math.floor(seconds / 3600); var minutes = Math.floor((seconds % 3600) / 60); var remainingSeconds = seconds % 60; var formattedTime = ""; if (hours > 0) { formattedTime += hours + "小时 "; } if (minutes > 0) { formattedTime += minutes + "分钟 "; } if (remainingSeconds > 0) { formattedTime += remainingSeconds + "秒"; } return formattedTime;