Sort out common PHP time functions and php function documents
Common time functions of php
Test environment: php5.3.29
Unix timestamp (the number of seconds from the Unix epoch (January 1 1970 00:00:00 GMT) to the given time .). The timestamp.
Returns the timestamp at a time.
Time ();
Obtains the timestamp of the current local time.
Mktime (hour, minute, second, month, day, year );
// The parameter can be omitted from the right to the left. The omitted parameter is replaced by the local time. For example, if the last day and the year are omitted, the current time is applied on January 22, 2016.
// Two or four digits can be written every year. When two digits are used, 0-69 corresponds to 2000-2069,70-100 corresponds to 1970-2000. The validity period of the four-digit test ranges from 1970 to 2037.
Date ('Y-m-d H: I ', $ time );
// Obtain the timestamp of parameter 2 in the format of parameter 1. This is my most commonly used format:
// Parameter 1 supports many other letter values, such as s (s with leading zeros), M (month with three abbreviations), and y (year with two digits), T (the time zone of the Local Machine), and so on.
Getdate ($ timestamp );
// Returns a unix timestamp in an array. The default value is the current local time. The returned format is as follows:
Array ([seconds] => 40 [minutes] => 58 [hours] => 9 // [mday] => 22 // Date [wday] => 6 // week 6 [mon] => 10 // October [year] => 2016 [yday] => 295 // 295th days of this year [weekday] => Saturday // 6 6 [month] => October // October [0] => 1055901520 // timestamp)
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!