I have a situation where I need to change the date format using PHP.
The site uses Joomla & k2. The template uses the following to obtain the articles publish date:
$itemCreated = JHTML::_('date', $item->created, JText::_('DATE_FORMAT_LC4'));
echo $itemCreated;
This will output the date in the following date format: A d B Y
I need to change it to appear in the date format: Y m d
(note: For those familar with Joomla & K2: I DO NOT want to use a language override. This particular task needs to be done only using PHP).
This is what you can do in PHP
Assuming you are rcieving the time
in UNIX Timestamp
$time = date('Y-m-d',strtotime($your_unix_timestamp));