Ec (2); date and time function library {often forgets} checkdate: verifies the correctness of the date. Date: format the server time. Strftime: format the server time locally. Getdate: Get the time and date information. Gettimeofday: Get the current
Godaddy hosts are abroad. The time zone conversion may be required when the site is built outside China. The following is a convenient tool function for time zone conversion.
Godaddy hosts are abroad. The time zone conversion may be required when
//the subscript of time inside ~ $index=Stripos($postdata[' Time '], ' ~ '); //Start Time $starttime=substr($postdata[' Time '], 0,$index); //End Time $endtime=substr($postdata[' Time '],$index+1, 5); //Length of
The world is divided into 24 time zones, GMT is a zero time zone, that is, the Greenwich Mean Time. China is located in GMT, eight hours more than GMT. For example, GMT is 09:45:32, and our time is 01:45:32.
The mktime () function of PHP returns
After loading the PHP5 you will find this problem:
You may find that the output time is not the same as your current time.
The reason is that if you do not set your server local time zone in the program or configuration file, the time taken
In PHP we have to add to the time and date we can use two functions, mktime and strtotime functions, let me give you students to introduce their use methods.
Mktime function
The Mktime () function returns a Unix timestamp for a date.
The parameter
GB2312 's Encode
Header ("Cache-control:no-store, No-cache, must-revalidate");
Header ("Cache-control:post-check=0, pre-check=0", false);
/* Focus on Understanding the Strtotime () function1, strftime than time () easy to use, you can directly use
I use the codeigniter framework to build a website, and use date ('Y-m-d h: I: s') to get the time and store it in the database. But today I found that, the storage time has a lot of time difference with my local storage.
Because the time zone
If the system does not set the time zone, the result is UTC time. Compared with Chinese users, the difference is 8 hours. & amp; lt ;? PhpclassDate {*** get or set the time zone ** @ paramint $ timezone time zone * @ returnstring | bool *
This article describes a PHP implementation of the time format check of a function to check whether a given time is well-formed. Please refer to the friends who are in need.The following code can be used to verify whether the time that the user
Calculating the time difference in php is sometimes troublesome! However, I believe that any language, as long as it holds the rule rate, will be able to find a way, it is absolutely magical. Date calculation is often performed in the work. The
A-"AM" or "PM"
A-"AM" or "PM"
D-A few days, two digits, if less than two is the front 0; such as: "01" to "31"
D-Days of the week, three English letters; such as: "Fri"
F-month, full name in English; such as: "January"
H-12 hours of the hour; such
Time () is the date of the server, so is the time in China the same as in the United States? Because of the development of a problem, the purchase of goods in China has ended, but foreign can also buy, all the time with time stamp, the database
Mktime ()
Convert date and time to UNIX timestamp
Time ()
Gets the Unix timestamp for the current time
echo Date ("Y-m-d", Mktime (0,0,0,12,31,2013)). "";
Example: Calculates the age of a user by calculating the
: This article mainly introduces the time zone of PHP. if you are interested in the PHP Tutorial, you can refer to it. Recently, I found that the formatting timestamp in PHP is 8 hours later than that in Beijing time. I found that the time zone was
format character
Description
example of return value
Day
---
---
D
The day ordinal of a month with a leading zero 2-digit number
01 to 31
J
The day ordinal of the month without
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.