Render the published date/time formatted in ISO 8601 using Timber (.twig)

I am setting up Google Tag Manager's Data Layer and I have a .twig as my header file. I need to produce the date and time of the post in ISO 8601 format.

"datePublished": "{{post.date}}"

This produces the date but not in the right format. How do I format the date/Time to this standard?

Thank you.

Answers 1

Related Questions