Reputation: 1615
I'm using (\DateTime::createFromFormat()
to parse a date.
In
"25/03/2017 10:43"
Out
"2020-07-25 10:00:00.000000"
Code
dd(\DateTime::createFromFormat("d/m/Y H:m", Request::get('start')));
The date is formed as follows: "dd/mm/yyyy". As you can see it's 3 years, 4 months, and 43 minutes off. The days and hours work fine though.
Upvotes: 1
Views: 542
Reputation: 14928
Change your date format to
DateTime::createFromFormat('d/m/Y H:i', '25/03/2017 10:43')
Note the i
: it means minutes. m
means months. See documentation.
Upvotes: 3
Reputation: 2294
The format character for minutes is i
and not m
.
dd(\DateTime::createFromFormat("d/m/Y H:i", Request::get('start')));
Upvotes: 1