Returning a datetime string in a case statement

Good day all, I am trying to return a string value using a this case statement:

,(CASE WHEN TSFO_DeliveredTime = '1900-01-01 00:00:00' THEN 'Not Delivered' ELSE TSFO_DeliveredTime END) AS Delivered

the ELSE part, i want it to return the value of the TSFO_Delivered when it has real data to display.
The ‘1900-01-01 00:00:00’ is a default input by the system when there is no data to display.

i get this error currently:
Conversion failed when converting date and/or time from character string.

Try CASTing or CONVERTing the datetime as a string; you will need to do it in both places. You could also perform the logic in Ignition, as a transform if using perspective or with numerous other methods if using vision.

Can anyone help me figure out how my transform needs to be Expressed?

I just started using ignition, but are you sure your syntax is correct? or are you using the Jython language?

I am using a SQL query, here is my whole code so far:

--		*
		 TSFO_MachineNumber 		AS 'Twister'
		,TSFO_DonLocation 			AS 'Pot_or_Creel'
		,TSFO_DeliveryByDateTime	AS 'ETA'
		,TSFO_BuggyNumber			AS 'Buggy'
		,TSFO_DelayReason			AS 'Delay'
		,(CASE WHEN TSFO_DeliveredTime = '1900-01-01 00:00:00' THEN 'Not Delivered' ELSE TSFO_DeliveredTime END) AS 'Delivered'
--		,TSFO_CompletionTime		AS 'Quad_Scan'
		,(CASE WHEN TSFO_CompletionTime = '1900-01-01 00:00:00' THEN 'Not Scanned' ELSE 'Scanned' END) AS Quad_Scan
		(TSFO_DeliveryByDateTime >= DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0) -- Beginning of the current day.
		AND TSFO_DeliveryByDateTime < DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()) + 1, 0)) -- Beginning of the next day.
		AND DATEPART(HOUR, TSFO_DeliveryByDateTime) BETWEEN 0 AND 23 -- Change for the hour range of the day, 0-23 always have results.
		AND TSFO_MachineNumber LIKE 'V042%' 
		TSFO_DeliveryByDateTime ASC

For reference this code got it working for my istance:

,(CASE WHEN TSFO_DeliveredTime = '1900-01-01 00:00:00' THEN 'Not Delivered' ELSE CONVERT(VARCHAR(25),TSFO_DeliveredTime,22) END) AS 'Delivered'