Start a conversation

PHP script does not display the appropriate time? Configure the date.timezone

It may so happen that the PHP scripts displays and incorrect time. The most probable cause would be, your web-site is hosted on a server that lies in a different time-zone. Tackling this issue is simple, you simply need to make changes to the settings (date.timezone) in PHP.

Based on the geo-location, one can make relevant ammendments to date.timezone in PHP by making use of the below mentioned option. You simply need to add it you the php.ini file.

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Dhaka"

Here we have considered that you wish to set the time-zone of your PHP scripts to Asia/Dhaka.
You may want to refer the following URL to know the supported time-zones in PHP. You just have to use the relevant time-zone as stated in the list. http://php.net/manual/en/timezones.asia.php

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Benajir Kamal

  2. Posted
  3. Updated

Comments