i tried to reformat date and time in magento.

from $order->getCreatedAtStoreDate()

i can get result = Feb 22, 2015 6:44:52 PM, but when i tried to reformat using this code

Mage::getModel('core/date')->date('Y-m-d h:i', strtotime($order->getCreatedAtStoreDate()));

i get result = 2015-02-22 10:44

i dont know what's wrong with it, please give me any advice.

thank you


you are using wrong date format in argument of function

use below format to get your desired out put

echo Mage::getModel('core/date')->date('M d, Y h:m:s', strtotime('2013-02-19 17:26:37'));


Feb 19, 2013 18:02:37

Hope this will sure work for you.

| improve this answer | |
  • @elune, hope my answer is sure useful to u. pls dont forget to acpt and vot up so some can use it for future – liyakat Mar 16 '15 at 9:21

That's because dates are always stored as UTC in the database, this is the raw value of the attribute, that you get with $order->getCreatedAtStoreDate()

The core/date model converts it to the store timezone. This is usually the desired behavior and the reason, you should always use the Magento methods to output dates.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.