简体   繁体   中英

SSRS IIF expression with Time

I have date in the format 1900-01-01 00:00:00.000 in the database. 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. How can I get the colons working in iif expressions in ssrs? 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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