Sunday, 17 March 2019

SSRS Date Format using Expression


Any column display with value of 1/1/1900 12:00:00 AM even after the SQL Server Query output is correct, you need to follow the below IIF statement in expression of SSRS


SELECT [ReviewDate] AS  [ReviewDate] from Tablename.


Review Date is datetime.


Solution to SSRS is: Editing the value like below. If the value is Null or Empty, the below one is a good one for that issue


=IIF(Fields!ReviewDate.Value="1/1/1900 12:00:00 AM","",Format(Fields!ReviewDate.Value,"dd-MM-yyyy"))




In SQL Server, you can use the query



SELECT isnull(Convert(Varchar(10),[ReviewDate],105),'') AS  [ReviewDate] from TableName



However, although the above SQL display is correct, it won't help in SSRS. Therefore, one should follow the above IIF statments, that is



=IIF(Fields!ReviewDate.Value="1/1/1900 12:00:00 AM","",Format(Fields!ReviewDate.Value,"dd-MM-yyyy"))





Normal Date Format formula is as per below:

=Format(CDate(Fields!ReviewDate.Value), "dd-MM-yyyy") -- Works well