Answer the question
In order to leave comments, you need to log in
Date formatting 1, Jan, 1998?
I get this format: 1, Jan, 1998
, I'm trying to convert:
gmdate("Y-m-d", strtotime("2, Jan, 1998"))
// а эту дату 10 Oct, 2007
$date = date_create('10 Oct, 2007');
dd( date_format($date, 'Y-m-d'));
//вернет 2017-10-10
$date = new \DateTime('10 Oct, 2007');
dd( $date->format('Y-m-d'));
Answer the question
In order to leave comments, you need to log in
Yes, Carbon is a super library, I always use it, but it's just a wrapper over native PHP functions for working with dates. But it's faster to do this (pure PHP):
$date = \DateTime::createFromFormat('d, F, Y', '2, Jan, 1998');
echo $date->format('Y-m-d');
echo \Carbon\Carbon::createFromFormat('d, F, Y', '2, Jan, 1998')->format('Y-m-d');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question