Level 80
@fogley If you read the Carbon docs on instantiation, there’s a createFromFormat() method. The first parameter is the format (as per PHP date function), and the second parameter is the value.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I trying to parse user submitted dates that vary wildly in format. So, to accommodate this I enable users to set the used format so that the system can save dates in a consistent format.
But, I cannot figure out if it's at all possible to tell Carbon to parse an arbitrary date string in a given format. And, if not: Is there any other realistic solution to this problem?
@fogley If you read the Carbon docs on instantiation, there’s a createFromFormat() method. The first parameter is the format (as per PHP date function), and the second parameter is the value.
Please or to participate in this conversation.