That doesn't appear to match the lines you have here.
You can't trigger an error on the format there since it must be an instance of DateTime in order to issue the format call. If $result['DateEntered'] is not an instanceof DateTime (null isn't an instance, nor is any scalar or non-DateTime object), then it will drop to the ternary else. You can't have a DateTime datatype without having a valid DateTime object; so null's or any scalar (ie: non-object) type cannot pass an instanceof check. Unless there's a bug of course, but I don't believe I've seen one like this.
Post more code for this; I suspect that you have another format call elsewhere and the line number you are looking at may be incorrect. I still can't get over that the SQLServer is automatically generating DateTime objects. Its also possible that you may be in a do/while?