Reputation: 45
I have faced a small issue. check the below code
echo date('Y-m-d', strtotime('15 Nov, 2018'));
I was expecting that it will return 2018-11-15 but when i echo the result it returns 2016-11-15,
Can some one tell me what is the issue. Thanks in advance
Upvotes: 0
Views: 304
Reputation: 428
This is because of comma. Following works fine after removing comma:
echo date('Y-m-d', strtotime(str_replace(',','','15 Nov, 2018')));
Upvotes: 1
Reputation: 1
Remove comma after Nov
echo date('Y-m-d', strtotime('15 Nov 2018'));
it will give you the correct result
Upvotes: 0