Solved: DateTime::__construct(): Failed to Parse Time String at Position 0 in Magento 2

Solved-DateTime construct()-Failed-to-Parse-Time-String-at-Position-0-in-Magento-2

Have you ever faced the error stated below while working with the date field on the checkout page of the Magento 2 store?

DateTime::__construct(): Failed to parse time string at position 0 : Unexpected character

If yes, then you are at the right place because we have the exact solution for you!

For instance, I’ve used my custom date field in the checkout page and storing the date in another format instead of its default, it results in the error that states Failed to parse time string at position 0 in Magento 2.

Check out the solution here:

Solution: DateTime::__construct(): Failed to Parse Time String at Position 0 in Magento 2

Use the below code in the file from which the date field is arriving.

That’s it.

If you have any doubts regarding this error, just mention them in the Comments section below.

I would be happy to help.

Feel free to share the solution with Magento Community via social media.

Thank You.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

5
(based on 11 Reviews)

Kanchi is a Magento Developer at Meetanshi. Apart from that, she is into dancing. In her free time, she likes to make handmade art and craft.

Leave a reply:

Your email address will not be published.