Timezone conversion in PHP


Today I am going to share some useful tip to convert country wise timezone in php

You can have time zone set for India as ‘Asia/Kolkata‘ this will add +5.30 to GMT time.

You will get proper time of your time zone.

Php code for Setting India Time Zone

$timezone = "Asia/Calcutta";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
echo date('d-m-Y H:i:s');

List of Asia Timezones

Asia/AdenAsia/AlmatyAsia/AmmanAsia/AnadyrAsia/Aqtau
Asia/AqtobeAsia/AshgabatAsia/AshkhabadAsia/BaghdadAsia/Bahrain
Asia/BakuAsia/BangkokAsia/BeirutAsia/BishkekAsia/Brunei
Asia/CalcuttaAsia/ChoibalsanAsia/ChongqingAsia/ChungkingAsia/Colombo
Asia/DaccaAsia/DamascusAsia/DhakaAsia/DiliAsia/Dubai
Asia/DushanbeAsia/GazaAsia/HarbinAsia/HebronAsia/Ho_Chi_Minh
Asia/Hong_KongAsia/HovdAsia/IrkutskAsia/IstanbulAsia/Jakarta
Asia/JayapuraAsia/JerusalemAsia/KabulAsia/KamchatkaAsia/Karachi
Asia/KashgarAsia/KathmanduAsia/KatmanduAsia/KolkataAsia/Krasnoyarsk
Asia/Kuala_LumpurAsia/KuchingAsia/KuwaitAsia/MacaoAsia/Macau
Asia/MagadanAsia/MakassarAsia/ManilaAsia/MuscatAsia/Nicosia
Asia/NovokuznetskAsia/NovosibirskAsia/OmskAsia/OralAsia/Phnom_Penh
Asia/PontianakAsia/PyongyangAsia/QatarAsia/QyzylordaAsia/Rangoon
Asia/RiyadhAsia/SaigonAsia/SakhalinAsia/SamarkandAsia/Seoul
Asia/ShanghaiAsia/SingaporeAsia/TaipeiAsia/TashkentAsia/Tbilisi
Asia/TehranAsia/Tel_AvivAsia/ThimbuAsia/ThimphuAsia/Tokyo
Asia/Ujung_PandangAsia/UlaanbaatarAsia/Ulan_BatorAsia/UrumqiAsia/Vientiane
Asia/VladivostokAsia/YakutskAsia/YekaterinburgAsia/Yerevan

If you want to set other country timezine – http://www.php.net/manual/en/timezones.php

Please don’t forget to share and subscribe to latest updates of the blog. Also any comments and feedback are all welcome!

Thanks!

You May Also Like

Never Miss Any Web Tutorials, Guides, Tips and Free eBooks

Join Our Community Of 50,000+ Web Lovers and get a weekly newsletter in your inbox

 

I hate spam too. Unsubscribe at any time.

Leave a Comment