I have a date value that is being passed as 201501.
How could I take that and display January 2015 instead?
It's being passed through a PHP variable.
Just try with:
$input = '201501';
$output = DateTime::createFromFormat('Ym', $input)->format('F Y');
Try below code
$data = '201501';
$monthNum = substr($data,4);
$year = substr($data,0,4);
$dateObj = DateTime::createFromFormat('!m', $monthNum);
$monthName = $dateObj->format('F');
echo $monthName.' '.$year;