Undefined error: 'None' has no attribute 'strftime'

I used frappe.utils.get_datetime(doc.reference_date).strftime("%Y-%m-%d") to fetch and format the date in print format but it returns an error.

Before this, the script is working fine but now, it’s suddenly it’s not working.