简体   繁体   English

具有时间的SSRS IIF表达式

[英]SSRS IIF expression with Time

I have date in the format 1900-01-01 00:00:00.000 in the database. 我在数据库中的日期格式为1900-01-01 00:00:00.000。 How can I write an IIF expression in SSRS iif date=1900-01-01 00:00:00.000 then display null or else display another field duration value. 如何在SSRS中编写IIF表达式,如果iif date = 1900-01-01 00:00:00.000,然后显示null或显示另一个字段持续时间值。 How can I get the colons working in iif expressions in ssrs? 我怎样才能让冒号在ssrs的iif表达式中起作用? I am getting an error field when I run the report. 运行报告时出现错误字段。 Can someone help me in this? 有人可以帮我吗?

You can write the expression like this: 您可以这样编写表达式:

=IIf(Fields!MyDate.Value <= "1/1/1900", Nothing, Fields!MyDate.Value)

Edit: 编辑:

You can also use 您也可以使用

=IIf(Fields!MyDate.Value <= "1/1/1900", 0, Fields!MyDate.Value)

And then you can set the formatting to: 然后可以将格式设置为:

=IIf(Fields!MyDate.Value <= "1/1/1900", "mm:ss tt", "d")

You can use whatever format string you want here. 您可以在此处使用所需的任何格式字符串。 "d" is short for the standard "Short Date" format. “ d”是标准“短日期”格式的缩写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM