Forum Discussion
luissantos920
Oct 13, 2024Copper Contributor
Supressing date 01-01-1900
I am creating a database view and need to format date field as yyyy-MM-dd while also supressing null dates which are showing up as 01-01-1900. The statement I am using is: CAST(ISNULL(FORMAT(my_d...
rodgerkong
Oct 13, 2024Iron Contributor
IIF is working, like this
DECLARE @a DATE
--SET @a = GETDATE() --Run this line get value to test
SELECT IIF(@a IS NULL, '', FORMAT(@a, 'yyyy-MM-dd'))luissantos920
Oct 14, 2024Copper Contributor
Hi there. It worked as suggested.
I also had to remove CAST ( ) as it would turn field into 01-01-1900 again which makes sense.
Thank you!!