Page 1 of 1

How to convert Decimal to Date using IsValid() function?

Posted: Fri Jan 21, 2011 1:00 pm
by sureshe005
How to convert Decimal to Date using IsValid() function.
Ex. 99991231 to 9999-12-31
Thanks in Advance

Re: How to convert Decimal to Date using IsValid() function?

Posted: Fri Jan 21, 2011 1:11 pm
by jwiles
isvalid() requires a string value, so:

Convert the decimal to a string
Use isvalid() to test the validity of the string
if valid then convert string to date

If the decimal is nullable be certain to handle nulls first in your logic.

IS 8.5 has expanded the functionality of isvalid() and has added type-specific functions such as isvaliddate().

Regards,