Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to change the time zone to US East by php

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how php changes time zone to US East", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can gain something after reading this article. Let's take a look at this "how php changes time zone to US East" article.

Modification method: 1, use "ini_set ('date.timezone',' America/New_York');" statement; 2, use "date_default_timezone_set ('America/New_York');" statement.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Division of time zone

The world is divided into 24 time zones, each of which has its own local time. At the same time, the local time of each time zone differs by 1: 23 hours. For example, the difference between London local time and Beijing local time is 8 hours.

In the field of international radio communications, a unified time is used, called Universal coordinated time (Universal Time Coordinated,UTC), and UTC is the same as Greenwich mean time (Greenwich Mean Time,GMT).

Php changes time zone to US East

1. Use the ini_set () function to set

The ini_set () function sets the value of the specified configuration option, which remains at the new value when the script runs and is restored at the end of the script. The syntax format of the function is as follows:

Ini_set ($varname, $newvalue)

Where $varname is the configuration option to be modified, and $newvalue is the new value of the configuration option.

Example:

Set the value of the date.timezonex entry to "America/New_York", that is, "United States / New York".

New York is in the east of the United States. New York is located in the northeast of the east coast of the United States, at the mouth of the Hudson River in southeastern New York, about halfway between Washington, D.C. And Boston, next to the Hudson River.

2. Use the date_default_timezone_set () function

The date_default_timezone_set () function sets a default time zone for all time and date functions in the script, and its syntax format is as follows:

Date_default_timezone_set ($timezone_identifier)

The parameter $timezone_identifier is a time zone identifier, such as UTC (Greenwich mean time) or Europe/Lisbon (Portugal).

Example:

The above is about the content of this article on "how to change the time zone of php to US East". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report