Converting total time in integer into HH:MM format

2020-07-30 02:32发布

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')

I don't know where i am getting wrong.

1条回答
冷血范
2楼-- · 2020-07-30 02:51

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')
查看更多
登录 后发表回答