将整数中的总时间转换为水晶报表中的 HH:MM 格式 [英] Converting total time in integer into HH:MM format in crystal report
本文介绍了将整数中的总时间转换为水晶报表中的 HH:MM 格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面给出的公式将水晶报告中的 3.50 小时更改为 03:30(HH:MM)格式,但它显示 04:30(自动添加 1 小时)
I am using below given formula to change 3.50 hours to 03:30(HH:MM) format in crystal report but it showing 04:30(1 hr added automatically)
numbervar totalHours:=ToNumber({Table.ExtraHoursOn1});
numbervar totalminutes:=ToNumber({Table.ExtraHoursOn1})*60 mod 60;
ToText(totalHours,0)+':'+
ToText(totalminutes,'00')
我不知道我哪里错了.
推荐答案
这是更改格式的正确语法,缺少截断功能
This is the right syntax for changing the format, truncate function was missing
numbervar totalHours:=ToNumber({Table.ExtraHoursOn1});
numbervar totalminutes:=ToNumber({Table.ExtraHoursOn1})*60 mod 60;
ToText(Truncate(totalHours),0)+':'+
ToText(totalminutes,'00')
这篇关于将整数中的总时间转换为水晶报表中的 HH:MM 格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文