Last active
July 12, 2017 17:47
-
-
Save ravixp/9d4ddc209cb5b38867cfdafdb1cfbbb7 to your computer and use it in GitHub Desktop.
Magento 1: Format Date and Time using Configuration options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Date Short Type --> | |
| <?php | |
| // Short Type | |
| //Output will be: 18/3/17 | |
| ?> | |
| <?php | |
| $today = '2017-03-18'; | |
| $date = Mage::helper('core')->formatDate($today, Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, false); | |
| echo $date; | |
| ?> | |
| <!-- Date Medium Type --> | |
| <?php | |
| // Medium Type | |
| //Output will be: 18 Mar, 2017 | |
| ?> | |
| <?php | |
| $today = '2017-03-18'; | |
| $date = Mage::helper('core')->formatDate($today, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, false); | |
| echo $date; | |
| ?> | |
| <!-- Date Long Type --> | |
| <?php | |
| // Long Type | |
| //Output will be: 28 March, 2017 | |
| ?> | |
| <?php | |
| $today = '2017-03-18'; | |
| $date = Mage::helper('core')->formatDate($today, Mage_Core_Model_Locale::FORMAT_TYPE_LONG, false); | |
| echo $date; | |
| ?> | |
| <!-- Date Full Type --> | |
| <?php | |
| // Full Type | |
| //Output will be: Friday, 18 March, 2017 | |
| ?> | |
| <?php | |
| $today = '2017-03-18'; | |
| $date = Mage::helper('core')->formatDate($today, Mage_Core_Model_Locale::FORMAT_TYPE_FULL, false); | |
| echo $date; | |
| ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment