Php Date_ Default Timezone In Php Date_Default_Timezone_Set() Function

What is default timezone in php? I checked it in the php.ini which shows the following with the timezone is left blank:

; Defines the mặc định timezone used by the date functions;date.timezone =;date.default_latitude = 31.7667;date.default_longitude = 35.2333;date.sunrise_zenith = 90.583333;date.sunset_zenith = 90.583333Then I want to lớn know which timezone is used by mặc định while manipulating times in PHP if I don"t mix it explicitly by using date_deafult_timezone_set() or any other means ?


Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)
PHP 7 AnswerModern versions of PHP (>= 5.4.0) use the following steps until a mặc định timezone is found:

Reading the timezone phối using the date_default_timezone_set() function (if any)

Reading the value of the date.timezone ini option (if set)

If none of the above succeed, the default timezone will be UTC.

Bạn đang xem: Php date_ default timezone in php date_default_timezone_set() function

The TZ environment variable is no longer used.



A simple code you have to lớn write for the default timezone. Which is:

date_default_timezone_get()Now how khổng lồ use:

You have to pass the timezone in this function lượt thích we want khổng lồ set India timezone as default see:

date_default_timezone_set("Asia/Kolkata"); Now, whenever you would use date(), automatically return India timezone.

I would refer if you want a example: how to convert default date timezone in php


When not specified date.timezone defaults to the system environment variable TZ.You can use this code to check your mặc định value date_default_timezone_get().

Xem thêm: Bụng To Ở Trẻ Sơ Sinh Bụng To, Bụng To Ở Trẻ Nhỏ (Bụng Cóc): Những Điều Cần Biết

Further info can be found here:


;date.timezone =; This is diasable textThis is working textGet it? with this ; On some ini files you can disable some scripts/codes.You can phối your time zone in php like: date_default_timezone_set("Europe/London"); & other like Europe/Amsterdam...Read more on php mặc định timezone


Thanks for contributing an answer lớn Stack Overflow!

Please be sure khổng lồ answer the question. Provide details và share your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Post Your Answer Discard

By clicking “Post Your Answer”, you agree lớn our terms of service, privacy policy & cookie policy

Site kiến thiết / hình ảnh sản phẩm © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. Rev2022.4.12.41952

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.