---
title: "How to Set the Timezone in PHP"
description: "If you notice the incorrect time in your PHP scripts, the likely culprit is that the hosting server is in a different timezone. For example, when you're an InMotion PHP web hosting customer, you can..."
url: https://www.inmotionhosting.com/support/website/set-timezone-in-php/
date: 2012-03-14
modified: 2023-08-15
author: "InMotion Hosting Contributor"
categories: ["Website"]
type: post
lang: en
---

# How to Set the Timezone in PHP

![](https://www.inmotionhosting.com/support/wp-content/uploads/2021/07/timezone-header-image-1024x538.jpg)

If you notice the incorrect time in your **PHP** scripts, the likely culprit is that the hosting server is in a different **timezone**.

For example, when you’re an InMotion [PHP web hosting](https://www.inmotionhosting.com/php-hosting) customer, you can select from data centers in Washington, D.C., or California, which means the server’s timezone will be either Eastern Standard Time (EST) or Pacific Standard Time (PST).

If you want to change that, it’s a quick fix. Simply insert a line of code into your php.ini file and the location you set in the code will determine the time to display in your PHP scripts. Keep reading to learn how.

## Set the Timezone in PHP

![How to change your website timezone using the php.ini file](https://i.ytimg.com/vi_webp/9HI2TqTU9vs/maxresdefault.webp)

1. Open your *php.ini* file with the [File Manager in cPanel](/support/edu/cpanel/using-file-manager-in-cpanel/) .
2. Add the following line of code to top of your *php.ini* file: `**date.timezone = "US/Central"**`.![Timezone in the php.ini file](https://www.inmotionhosting.com/support/wp-content/uploads/2012/03/timezone_1.jpg) Replace `**US/Central**` with the timezone [from here](https://www.php.net/manual/en/timezones.php) that corresponds to the time you want to display. Once you have entered the desired timezone, click **Save Changes** to save the file. ![Save changes for new time zone](https://www.inmotionhosting.com/support/wp-content/uploads/2012/03/timezone_2.jpg) Now, you can check your *[phpinfo.php](https://www.inmotionhosting.com/support/website/how-to-create-a-phpinfo-page/)* page to verify the change took place. ![Timezone setting before change](https://i0.wp.com/www.inmotionhosting.com/support/wp-content/uploads/2012/03/timezone_3.jpg?ssl=1)![Timezone after change](https://i0.wp.com/www.inmotionhosting.com/support/wp-content/uploads/2012/03/timezone_4.jpg?ssl=1)Drag the arrow to the right to see the change in the timezone setting Congratulations! You are now able to set the timezone in PHP. If you wish to see more guides with tips and information for your website issues, please see our [InMotion Hosting Support Center](https://www.inmotionhosting.com/support/)! Sell hosting using your own brand with a powerful [Reseller Hosting](https://www.inmotionhosting.com/reseller-hosting) plan, now with more resources and faster storage using NVMe SSDs at no extra cost.
