Skip to content

Instantly share code, notes, and snippets.

@abdev
Created July 10, 2012 12:44
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save abdev/3083037 to your computer and use it in GitHub Desktop.
Save abdev/3083037 to your computer and use it in GitHub Desktop.
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