0

My store is from Chile

I'll set timezone America/Santiago from the backend. When I place the order, it gets the wrong time. I created one script and write below code.

  <?php require 'app/Mage.php';
    Mage::app();
    echo Mage::getModel('core/date')->gmtDate('Y-m-d H:i:s');
?>

Tt returns 2018-09-07 11:30:43 but the current time in Chile is 2018-09-07 10:30:43 Can anyone have a solution for this?

  • check your server timezone – Naveed Asim Sep 7 '18 at 5:12
  • how can i check my server time? – Jigs Parmar Sep 7 '18 at 5:15
  • write a php script and and echo date function – Naveed Asim Sep 7 '18 at 5:16
  • it returns the same – Jigs Parmar Sep 7 '18 at 5:19
  • please check my answer and let me know if still not solve. – Rohan Hapani Sep 7 '18 at 5:40
0

Try to use this code :

<?php 
$date = new DateTime();
$date->setTimezone(new DateTimezone('America/Santiago'));
echo $date->format('Y-m-d H:i:s');
?>
  • when order is place it take wrong time – Jigs Parmar Sep 7 '18 at 5:57
  • so i want to set tizone globally and when i use Mage::getModel('core/date')->gmtDate('Y-m-d H:i:s') than it return right time – Jigs Parmar Sep 7 '18 at 5:57

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.