Timestamp template not working as sensor, but works in template editor

Please post your templates using the community standards. It allows folks to test your code without rewriting from a pic.