我尝试过: 我试过了 =(Day(Fields!hours.value)* 24)+(Fields!hours.Value) 但它不工作 有什么解决方案吗?解决方案 如比尔伍德拉夫所说,你是多少小时24,然后加上小时数,有效地产生,小时25次。你需要提取24天的天数,然后加上几小时。 如果小时字段保存TimeSpan值,然后您可以使用 TimeSpan.TotalHours属性(系统)| Microsoft Docs [ ^ ] 如何在SSRS中使用TimeSpan。您必须添加以下功能: 公共 功能 GetTotalHours(ts As TimeSpan) As Integer 返回 ts.TotalHours 结束 功能 怎么样? 将代码添加到报表(SSRS) - SQL Server Reporting Services(SSRS)| Microsoft Docs [ ^ ] 然后添加如下公式: = IIF(IsNothing(Fields!hours.Value), Nothing ,Code.GetTotalHours(Fields!hours.Value) ) I have one field hourshours value will be timespan it means Day.Hour:Minute:SecondI want only hours from "hours" field but including day also.For Ex.if hours value is 1.12:10:00output should be 24+12=36 hoursWhat I have tried:I have tried =(Day(Fields!hours.value)*24)+(Fields!hours.Value)but it is not workingIs there any solution? 解决方案 AS Bill Woodruff noted, you are multiplyin g the hours by 24, then adding the hours to that, effectively yielding, hour times 25. You need to extract the days times 24, then add hours to that.If hours field holds TimeSpan value, then you can use TimeSpan.TotalHours Property (System) | Microsoft Docs[^] How to use TimeSpan in SSRS. You have to add below function:Public Function GetTotalHours(ts As TimeSpan) As IntegerReturn ts.TotalHoursEnd FunctionHow? Add Code to a Report (SSRS) - SQL Server Reporting Services (SSRS) | Microsoft Docs[^]Then add formula like this:=IIF(IsNothing(Fields!hours.Value), Nothing, Code.GetTotalHours(Fields!hours.Value)) 这篇关于如何在ssrs报告中将时间天数从时间跨度转换为小时数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-23 09:56