Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Magento - format date from local format to magento internal format
$myDate = '07/10/12';//2012-07-10
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$date = Mage::app()->getLocale()->date(
$myDate,
Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
null,
false
);
$formatedDate = $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment