I try to modify default New Order email template.

Currently, I get order datetime by {{var order.getCreatedAtFormated('short')}}. It results 6/18/2015 12:18 PM.

I want to include timezone following datetime, expected result is 6/18/2015 12:18 PM GMT+7.

I dive into Magento Core code to understand how it works, then I try

{{var order.getCreatedAtFormated('short')}} {{var order.getCreatedAtStoreDate().getTimezone()}}
but it doesn't work.

I know that if it works, getTimezone() may result Asisa/Saigon instead of GMT+7 as expected.

So, how to get order datetime including timezone?

  • You need to get the store timezone as GMT+7 Right? Jul 10, 2015 at 14:20
  • @MeenakshiSundaramR: no, assume that my store locale is GMT+7, then I need to get the text GMT+7 appending to default datetime (only date and time) Jul 10, 2015 at 14:40
  • ok i'll try the code and give the answer Jul 10, 2015 at 14:52
  • 1
    check my answer. Jul 11, 2015 at 11:21

1 Answer 1


There is no native function to get the GMT time value.

To get the GMT value of order created datatime.

I have rewrite the Mage_Sales_Model_Order and write new function to get the GMT.

(Refer magento model rewrite Tutorial)

public function getGmtValue()
    $timeZone = $this->getCreatedAtStoreDate()->getTimezone();
    $currentTimezone = date_default_timezone_get();
    //Get GMT
    $value = date('P', strtotime($this->getCreatedAtStoreDate()));
    return 'GMT'.$value;

Now you can get GMT value in email template by following code.

{{var order.getGmtValue()}}

I have refer these two links to get the GMT value

1.how do i get greenwich mean time in php

2.datetime to timestamp in php

  • Thank you. I've tested your modification and it worked. Anyway I will leave the question unanswered for a short time to get more attentions for other solutions without modifying the Core codes or requiring extensions. Jul 11, 2015 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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