PHP Tutorial Set the Date_default_timezone_set function ()
Definition and usage
The Date_default_timezone_set () function sets the default time zone for all date/time functions used in the script.
GrammarDate_default_timezone_set (TimeZone)
$
Error page code: server in USA
Date_default_timezone_set ('prc'); // The time zone is set here.
$ Now_day = date ('L ');
$ Now_date = date ("Y/m/d ");
Echo "now_day =". $ now_day ."
";
Echo "now_date =". $ now_date ."
";
Echo time
Java extracts the time in the visita Environment 8 hours earlier than the correct system time, because our time zone is set to Beijing time (that is, GMT + 8)
Use the followingCodeA problem occurs when the time is used:
Calendar c =
The date. timezone option has been added to PhP. ini since php5.1.0. It is disabled by default.
That is, the displayed time (no matter what php Command is used) is the Greenwich Mean Time.
The difference between the time and our time (Beijing
Copy codeThe Code is as follows:
obtain Server Information
$ Sysos = $ _ SERVER ["SERVER_SOFTWARE"]; // gets the string of the SERVER ID
$ Sysversion = PHP_VERSION; // get the PHP server version
// The following two codes connect to the MySQL
After finding the cause, I found some methods for setting the time zone of PHP on the Internet:
1. Modify php. ini, find data. timezone = in php. ini, remove the; sign, and set data. timezone = "Asia/Shanghai.
2. Use the ini_set function ('date.
HiNow is Friday, the night, because back to the bedroom also seems to have nothing to do, as in the Department of Water a water.1. PHP---Cookie-----Set Cookies:The most common way to set up cookies in PHP is to use the Setcookie function, Setcookie
Php sets the Beijing time function date_default_timezone_set (). In the php Tutorial, set the definition and usage of the Beijing time function date_default_timezone_set () to the default time zone of all date and time functions in the script.
The timezone setting method in php. If you are using an independent server and have the permission to modify the configuration file, you can set the time zone by modifying the date. timezone attribute in php. ini. You can set the value of this
This article mainly introduces the PHP default time zone changes, has a certain reference value, now share to everyone, the need for friends can refer to
Each region has its own local time, and in the Internet and radio communication, time
1. QuestionsFor machines with Windows and Linux systems, the time to enter Windows is inconsistent with Linux, and Linux is 8 hours ahead of Windows.2. SolutionTo modify/etc/default/rcs, set not to use UTC time, set the following:Utc=no3.
Each region has its own local time. In online and radio communication, the time conversion problem is particularly prominent. The whole earth is divided into 24 time zones, each time zone has its own local time. For international radio or network
One of the most important modules in website or mobile development is the login login module.For development, the most common sub-modules considered by the login module are:1. Get the login user information from the database, getusercredentialsuch
Time Display of different logs.
Event Log-the time when the machine that captures logs is converted to your time zone
SharePoint Audit Log-Greenwich mean time (GMT + 0) (Note: Beijing time is GMT + 8)
Performance log-machine time when
Gets the current UNIX timestampThe UNIX timestamp (called: timestamp) is a very important concept in PHP for time and date, which represents the sum of the seconds from January 1, 1970 00:00:00 to the current time.PHP provides a built-in function
Differences Between Calendar and Date in Android and how to eliminate the impact of Time Zone on Date operations
There are three common date operations in Android:
Date typeCalendar typeUnix TimestampAmong them, Unix timestamps are the most
Set the Beijing time function date_default_timezone_set () in the php tutorial ()Definition and usageThe date_default_timezone_set () function is used to set the default time zone of all date/time functions in the script.
SyntaxDate_default_timezone_
Two common functions in PHPrand (); Generate random numbers when there are no parameters in parentheses, the system generates random numbers at the current time as a seedrand (1,10); Inside the parentheses is a range of generated random numbers, in
Datedate represents a specific moment, accurate to milliseconds. Before JDK1.1, date has two other functions. It allows you to interpret dates as year, month, day, hour, minute, and second values. It also allows formatting and parsing of date
Recently found in debugging interfaces: The time format in the JSON data format passed over by the interface is in the form of a string:{"Name": "Full 300 send", "Merchantid": "1", "Needmoney": "$", "money": "", "Usemoney": "", "Begindatetime": "2017
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.