Want to subscribe to topics you're interested in?
Become a Member

Featured Install Changing default CentOS system timezones

Discussion in 'Install & Upgrades or Pre-Install Questions' started by eva2000, Jun 8, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:40 PM
    Nginx 1.13.x
    MariaDB 5.5
    In centmin.sh there's a variable called ZONEINFO which can be changed prior to Centmin Mod install to set the default CentOS system timezone. This system timezone can also be changed after install as per FAQ 8 http://centminmod.com/faq.html.

    Full example of post-install timezone changes are outlined at http://centminmod.com/datetimezones.html.

    For example for Greece, Athens you can use ZONEINFO=Europe/Athens

    Code:
    ls -lah /usr/share/zoneinfo/Europe/
    total 244K
    drwxr-xr-x.  2 root root 4.0K Jun  2 06:33 .
    drwxr-xr-x. 20 root root 4.0K Jun  2 06:33 ..
    -rw-r--r--.  1 root root 2.9K May 15 05:05 Amsterdam
    -rw-r--r--.  1 root root 1.7K May 15 05:05 Andorra
    -rw-r--r--.  1 root root 2.2K May 15 05:05 Athens
    -rw-r--r--.  7 root root 3.6K May 15 05:05 Belfast
    -rw-r--r--.  6 root root 1.9K May 15 05:05 Belgrade
    -rw-r--r--.  1 root root 2.3K May 15 05:05 Berlin
    -rw-r--r--.  2 root root 2.2K May 15 05:05 Bratislava
    -rw-r--r--.  1 root root 2.9K May 15 05:05 Brussels
    -rw-r--r--.  1 root root 2.2K May 15 05:05 Bucharest
    -rw-r--r--.  1 root root 2.4K May 15 05:05 Budapest
    -rw-r--r--.  3 root root 1.9K May 15 05:05 Busingen
    -rw-r--r--.  2 root root 2.4K May 15 05:05 Chisinau
    -rw-r--r--.  1 root root 2.1K May 15 05:05 Copenhagen
    -rw-r--r--.  2 root root 3.5K May 15 05:05 Dublin
    -rw-r--r--.  1 root root 3.0K May 15 05:05 Gibraltar
    -rw-r--r--.  7 root root 3.6K May 15 05:05 Guernsey
    -rw-r--r--.  2 root root 1.9K May 15 05:05 Helsinki
    -rw-r--r--.  7 root root 3.6K May 15 05:05 Isle_of_Man
    -rw-r--r--.  3 root root 2.7K May 15 05:05 Istanbul
    -rw-r--r--.  7 root root 3.6K May 15 05:05 Jersey
    -rw-r--r--.  1 root root 1.5K May 15 05:05 Kaliningrad
    -rw-r--r--.  1 root root 2.1K May 15 05:05 Kiev
    -rw-r--r--.  2 root root 3.4K May 15 05:05 Lisbon
    -rw-r--r--.  6 root root 1.9K May 15 05:05 Ljubljana
    -rw-r--r--.  7 root root 3.6K May 15 05:05 London
    -rw-r--r--.  1 root root 2.9K May 15 05:05 Luxembourg
    -rw-r--r--.  1 root root 2.6K May 15 05:05 Madrid
    -rw-r--r--.  1 root root 2.6K May 15 05:05 Malta
    -rw-r--r--.  2 root root 1.9K May 15 05:05 Mariehamn
    -rw-r--r--.  1 root root 1.3K May 15 05:05 Minsk
    -rw-r--r--.  1 root root 2.9K May 15 05:05 Monaco
    -rw-r--r--.  2 root root 1.5K May 15 05:05 Moscow
    -rw-r--r--.  2 root root 2.0K May 15 05:05 Nicosia
    -rw-r--r--.  3 root root 2.2K May 15 05:05 Oslo
    -rw-r--r--.  1 root root 2.9K May 15 05:05 Paris
    -rw-r--r--.  6 root root 1.9K May 15 05:05 Podgorica
    -rw-r--r--.  2 root root 2.2K May 15 05:05 Prague
    -rw-r--r--.  1 root root 2.2K May 15 05:05 Riga
    -rw-r--r--.  3 root root 2.6K May 15 05:05 Rome
    -rw-r--r--.  1 root root 1.3K May 15 05:05 Samara
    -rw-r--r--.  3 root root 2.6K May 15 05:05 San_Marino
    -rw-r--r--.  6 root root 1.9K May 15 05:05 Sarajevo
    -rw-r--r--.  1 root root 1.5K May 15 05:05 Simferopol
    -rw-r--r--.  6 root root 1.9K May 15 05:05 Skopje
    -rw-r--r--.  1 root root 2.1K May 15 05:05 Sofia
    -rw-r--r--.  1 root root 1.9K May 15 05:05 Stockholm
    -rw-r--r--.  1 root root 2.2K May 15 05:05 Tallinn
    -rw-r--r--.  1 root root 2.1K May 15 05:05 Tirane
    -rw-r--r--.  2 root root 2.4K May 15 05:05 Tiraspol
    -rw-r--r--.  1 root root 2.1K May 15 05:05 Uzhgorod
    -rw-r--r--.  3 root root 1.9K May 15 05:05 Vaduz
    -rw-r--r--.  3 root root 2.6K May 15 05:05 Vatican
    -rw-r--r--.  1 root root 2.2K May 15 05:05 Vienna
    -rw-r--r--.  1 root root 2.2K May 15 05:05 Vilnius
    -rw-r--r--.  1 root root 1.2K May 15 05:05 Volgograd
    -rw-r--r--.  2 root root 2.7K May 15 05:05 Warsaw
    -rw-r--r--.  6 root root 1.9K May 15 05:05 Zagreb
    -rw-r--r--.  1 root root 2.1K May 15 05:05 Zaporozhye
    -rw-r--r--.  3 root root 1.9K May 15 05:05 Zurich
    You'd want to change your /usr/local/lib/php.ini defined timezone too date.timezone according to predefined ones at http://www.php.net//manual/en/timezones.php
     
    Last edited: Jun 9, 2014
    • Like Like x 1
  2. RoldanLT

    RoldanLT Well-Known Member

    3,822
    928
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,256
    Local Time:
    9:40 PM
    1.11
    10.2
    It didn't apply automatically for me with Asia/Manila on php.ini on my 1st install.
     
  3. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:40 PM
    Nginx 1.13.x
    MariaDB 5.5
    it should set to UTC with inc/phpsededit.inc line 2 to 6 at https://github.com/centminmod/centminmod/blob/123.07beta21/inc/phpsededit.inc#L2

    Code:
        if [[ "$(date +"%Z")" = 'EST' ]]; then
        sed -i "s/;date.timezone =/date.timezone = Australia\/Brisbane/g" /usr/local/lib/php.ini
        else
        sed -i "s/;date.timezone =/date.timezone = UTC/g" /usr/local/lib/php.ini
        fi
    what does the command below return
    Code:
    echo $(date +"%Z")
     
  4. RoldanLT

    RoldanLT Well-Known Member

    3,822
    928
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,256
    Local Time:
    9:40 PM
    1.11
    10.2
    It's "PHT" because I manually edited the php.ini file.
     
  5. RoldanLT

    RoldanLT Well-Known Member

    3,822
    928
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,256
    Local Time:
    9:40 PM
    1.11
    10.2
    For Philippines I should use UTC or EST?
     
  6. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:40 PM
    Nginx 1.13.x
    MariaDB 5.5
    For system timezone or PHP ?

    For system pick closest city on Asia directory listing, i.e. Asia/Manila

    Code:
    ls /usr/share/zoneinfo/Asia/   
    Aden      Ashkhabad  Brunei      Damascus  Hebron       Jayapura   Katmandu      Macao     Novokuznetsk  Qatar      Seoul      Tel_Aviv       Urumqi
    Almaty    Baghdad    Calcutta    Dhaka     Ho_Chi_Minh  Jerusalem  Khandyga      Macau     Novosibirsk   Qyzylorda  Shanghai   Thimbu         Ust-Nera
    Amman     Bahrain    Choibalsan  Dili      Hong_Kong    Kabul      Kolkata       Magadan   Omsk          Rangoon    Singapore  Thimphu        Vientiane
    Anadyr    Baku       Chongqing   Dubai     Hovd         Kamchatka  Krasnoyarsk   Makassar  Oral          Riyadh     Taipei     Tokyo          Vladivostok
    Aqtau     Bangkok    Chungking   Dushanbe  Irkutsk      Karachi    Kuala_Lumpur  Manila    Phnom_Penh    Saigon     Tashkent   Ujung_Pandang  Yakutsk
    Aqtobe    Beirut     Colombo     Gaza      Istanbul     Kashgar    Kuching       Muscat    Pontianak     Sakhalin   Tbilisi    Ulaanbaatar    Yekaterinburg
    Ashgabat  Bishkek    Dacca       Harbin    Jakarta      Kathmandu  Kuwait        Nicosia   Pyongyang     Samarkand  Tehran     Ulan_Bator     Yerevan
    For PHP closest on Asia listing http://www.php.net/manual/en/timezones.php at http://www.php.net/manual/en/timezones.asia.php

    Code:
    Asia/Aden    Asia/Almaty    Asia/Amman    Asia/Anadyr    Asia/Aqtau
    Asia/Aqtobe    Asia/Ashgabat    Asia/Ashkhabad    Asia/Baghdad    Asia/Bahrain
    Asia/Baku    Asia/Bangkok    Asia/Beirut    Asia/Bishkek    Asia/Brunei
    Asia/Calcutta    Asia/Choibalsan    Asia/Chongqing    Asia/Chungking    Asia/Colombo
    Asia/Dacca    Asia/Damascus    Asia/Dhaka    Asia/Dili    Asia/Dubai
    Asia/Dushanbe    Asia/Gaza    Asia/Harbin    Asia/Hebron    Asia/Ho_Chi_Minh
    Asia/Hong_Kong    Asia/Hovd    Asia/Irkutsk    Asia/Istanbul    Asia/Jakarta
    Asia/Jayapura    Asia/Jerusalem    Asia/Kabul    Asia/Kamchatka    Asia/Karachi
    Asia/Kashgar    Asia/Kathmandu    Asia/Katmandu    Asia/Khandyga    Asia/Kolkata
    Asia/Krasnoyarsk    Asia/Kuala_Lumpur    Asia/Kuching    Asia/Kuwait    Asia/Macao
    Asia/Macau    Asia/Magadan    Asia/Makassar    Asia/Manila    Asia/Muscat
    Asia/Nicosia    Asia/Novokuznetsk    Asia/Novosibirsk    Asia/Omsk    Asia/Oral
    Asia/Phnom_Penh    Asia/Pontianak    Asia/Pyongyang    Asia/Qatar    Asia/Qyzylorda
    Asia/Rangoon    Asia/Riyadh    Asia/Saigon    Asia/Sakhalin    Asia/Samarkand
    Asia/Seoul    Asia/Shanghai    Asia/Singapore    Asia/Taipei    Asia/Tashkent
    Asia/Tbilisi    Asia/Tehran    Asia/Tel_Aviv    Asia/Thimbu    Asia/Thimphu
    Asia/Tokyo    Asia/Ujung_Pandang    Asia/Ulaanbaatar    Asia/Ulan_Bator    Asia/Urumqi
    Asia/Ust-Nera    Asia/Vientiane    Asia/Vladivostok    Asia/Yakutsk    Asia/Yekaterinburg