SSRS - hh:mm:ss tt 显示为 "hh:mm:ss tt" 而不是实际时间

SSRS - hh:mm:ss tt showing as "hh:mm:ss tt" and not an actual time

对报告和所有内容来说仍然很新,目前正在尝试修改报告的时间格式,我希望它显示为(例如)02:30:05 PM 而不是 current/default 14:30:05.

这是我目前的情况:

="between the hours of " & Format(Parameters!StartTime.Value, "hh:mm:ss tt") & " and " & Format(Parameters!EndTime.Value, "hh:mm:ss tt") & " (" & Parameters!TimeZone.Label & ")"

问题是 运行 报告显示为 "between the hours of hh:mm:ss tt and hh:mm:ss tt" 而不是 "between the hours of 02:30:05 PM and 03:30:05 PM"。

关于为什么会这样有什么想法吗?谢谢!

这似乎是您参数的数据类型导致的。您目前很可能已将其设置为 Text。在参数属性中,将其更改为 Date/Time。这将允许 Format 函数将其解释为日期和时间而不是字符串。

或者,您可以将参数值转换为表达式中的日期,如下所示:

Format(CDate(Parameters!StartTime.Value), "hh:mm:ss tt")