0

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

3 Answers 3

1

This is because of comma. Following works fine after removing comma:

echo date('Y-m-d', strtotime(str_replace(',','','15 Nov, 2018')));
Sign up to request clarification or add additional context in comments.

Comments

0

try removing the comma : echo date('Y-m-d', strtotime('15 Nov 2018'));

Read more about the supported formats here : strtotime

Comments

0

Remove comma after Nov

echo date('Y-m-d', strtotime('15 Nov 2018'));

it will give you the correct result

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.