I'm trying to convert a DateTime value from UTC (as it is currently stored
in the database) the the machine's local time.
I tried using:
=Fields!end_dt.Value.ToLocalTime()
And this works so long as there is a DateTime value for the field, but a
warning is thrown if the value is null in the database (this is an optional
field).
I've tried using an iif statment:
=iif(Fields!end_dt.Value is nothing, "", Fields!end_dt.Value.ToLocalTime())
But this still returns the warning as iif evaluates the "false" side whether
or not end_dt contains a value.
Now while the report does render, ideally I don't want any errors or
warnings to be generated, is there any way around this?
Thanks,
JIIF (like all functions) evaluates all of its arguments. So even though
you're testing for Nothing, you're still evaluating
Fields!end_dt.Value.ToLocalTime()
Try this:
=iif(Fields!end_dt.Value is nothing, "", iif( Fields!end_dt.Value is
nothing, DateTime.Parse("12:00"), Fields!end_dt.Value).ToLocalTime())
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"J Smith" <rs-nntp@.jascentral.com> wrote in message
news:%23bx2OmSlEHA.1936@.TK2MSFTNGP12.phx.gbl...
> I'm trying to convert a DateTime value from UTC (as it is currently stored
> in the database) the the machine's local time.
> I tried using:
> =Fields!end_dt.Value.ToLocalTime()
> And this works so long as there is a DateTime value for the field, but a
> warning is thrown if the value is null in the database (this is an
> optional
> field).
> I've tried using an iif statment:
> =iif(Fields!end_dt.Value is nothing, "",
> Fields!end_dt.Value.ToLocalTime())
> But this still returns the warning as iif evaluates the "false" side
> whether
> or not end_dt contains a value.
> Now while the report does render, ideally I don't want any errors or
> warnings to be generated, is there any way around this?
> Thanks,
> J
>
No comments:
Post a Comment