I have a problem getting the year and month from the date given. I have this date 201911.. when i use
date('F Y',strtotime(201911))..
it shows Oct-19. It should be Nov-19
I have a problem getting the year and month from the date given. I have this date 201911.. when i use
date('F Y',strtotime(201911))..
it shows Oct-19. It should be Nov-19
You would do better to use date_create_from_format
:
$date = date_create_from_format('Ym', 201911);
echo $date->format('F Y');
Output:
November 2019
You are almost there. Just put ' around your String
echo date('F Y',strtotime('2019-11'));
Echo: November 2019
All of another responses are ok!. the problem is that you dont tell to php what is the format of the date that you need trasform.
DateTime::createFromFormat('Ym', 201911)->format('F Y');