将天数转换为小时数
将天数转换为小时数
截断时钟时间以删除秒数或分钟数。将时间四舍五入到最接近的小时数、分钟数或自定义间隔。
截断时钟时间是指从格式化的时间字符串(HH:MM:SS)中删除指定的时间部分。它可以只删除秒数部分,保留小时和分钟(hh:mm),也可以删除分钟和秒数,只保留小时,或者结合零填充选项来实现精确的时间格式化需求。
In this example we remove the seconds component from several time values. Select 'Truncate Only Seconds' mode to get a list of time values containing only hours and minutes, in the format 'HH:MM' (the ':SS' part is removed).
This example truncates five clock times to hours. It removes both minutes and seconds and outputs only the hours with zero padding.
In this example we first truncate times to minutes and then set their seconds component to zero by attaching a zero in place of removed seconds. To do this, we turn on the seconds truncation mode and activate the option to print zero time parts. We also disable the padding option and get output times in the format 'h:m:s' where seconds will always be zeroes, resulting in the final 'h:m:0' format.