SSRS 计算两个日期之间的持续时间

SSRS Calculate duration between two dates

如何在 SSRS 表达式中编写下面的 SSRS 计算

实际计算示例如下 =((deldate+deltime) –(orddate+ordtime))*24

deldate     delTime  orddate    ordTime  *24
13/01/2015  14:25   14/01/2015  13:55    23.50
20/01/2015  12:00   20/01/2015  17:02    5.03

这适用于 SQL Toad 但不适用于 SSRS

(TO_DATE(TO_CHAR(A.DELDATE,'DD/MM/YYYY') ||' '|| TO_CHAR(A.DELTIME,'HH24:MI'),'DD/MM/YYYY HH24:MI') - TO_DATE(TO_CHAR(A.ORDDATE,'DD/MM/YYYY') ||' '|| TO_CHAR(A.ORDTIME,'HH24:MI'),'DD/MM/YYYY HH24:MI'))*24 AS "DiffinHours",

TO_CHARs 更改为 Format,将 TO_DATEs 更改为 CDate,并使用 DateDiff 而不是减法。要获得小数小时数,求出分钟数的差值并除以 60.0:

=DateDiff(DateInterval.Minute, 
          CDate(Format(Fields!deldate.Value, "MM/dd/yyyy") & " " & Format(Fields!deltime.Value, "HH:mm")), 
          CDate(Format(Fields!orddate.Value, "MM/dd/yyyy") & " " & Format(Fields!ordtime.Value, "HH:mm"))
         ) / 60.0