Magento: Datetime of server and datetime of Magento don't match

We’ve got the exact same issue happening; our server is CDT (GMT -5 hours) and it’s also set to Central time in Magento, but there’s several times when date() calls are performed when it returns the time in UTC (GMT+0 hours, effectively), thereby causing some dates and times to be off by 5 hours. What we did to fix it is:

1) Ensured the clock on our webserver was set to the correct time and time zone: http://www.wikihow.com/Change-the-Timezone-in-Linux
2) Ensured that PHP is set to the correct time zone: http://www.electrictoolbox.com/correct-php-timezone/
3) Ensured that Magento was also set to the correct time zone (System -> Configuration -> General)
4) Changed the default time zone in Magento from UTC to our timezone: edit app/code/core/Mage/Core/Model/Locale.php
Find line 30 and change to:

//const DEFAULT_TIMEZONE = 'UTC';
const DEFAULT_TIMEZONE = '
Europe/Rome'; // Use your time zone as found in http://www.php.net/manual/en/timezones.php

5) Change the default timezon in file 'app/Mage.php'

//date_default_timezone_set('UTC');

date_default_timezone_set('Europe/Rome');

Chances are high that your web server is already set up correctly, and if you’re not running a dedicated server your host will be the one to determine steps 1 & 2. Steps 3-4 are the important ones for you to do. Note that because you’re editing a core file, your changes will have to be re-applied each time you upgrade (as necessary).

N.B.: for timezone costants see : http://www.php.net/manual/en/timezones.php

Site Search

Who's Online

Abbiamo 16 visitatori e nessun utente online

Stats

Visite agli articoli
167728
banner mym
banner mym