PHP Time Functions

Source: Internet
Author: User

Introduction: This is a detailed page of PHP time functions. It introduces related knowledge, skills, experiences, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 326919 'rolling = 'no'>

The time functions in PHP are as follows:

(1) Date

Usage:

Date (format, 1141064899 );

If there is no time parameter, the current time is used. The format is a string. The following characters have special meanings:

U is replaced with the number of seconds since the start time (like January 1, 1970), Y is replaced with the four-digit year number.

Y is replaced with the 2-digit year number.

F is replaced with the full name of the month.

M is replaced with the abbreviation of the month.

M is replaced with the monthly number of copies.

Z is replaced by the number of days since January 1 of the current year.

D. Replace it with the daily number.

L replace it with the full name of the day of the week.

D. Replace it with the abbreviation of the day of the week.

W is replaced with the day of the week (number ).

Replace h with the hour (in the 24-hour format ).

Replace h with the hour (in 12-hour format ).

Replace I with the number of minutes.

Replace s with the number of seconds.

A is replaced with "am" or "PM ".

A is replaced with "am" or "PM ".

S is replaced with a sequential numeric suffix, for example, "St", "nd", "RD", "th ".

The function returns a formatted string that has been replaced.

(2) getdate (time)

Returns a hash table with the following subscripts:

"Seconds" -- seconds

"Minutes" -- score

"Hours" -- hours

"Mday" -- Number of days

"Mon" -- number of months

"Year" -- year

"Yday" -- Number of days since January 1, January 1

"Weekday"-the day of the week.

"Month" -- month, full English name

(3) gmdate

Similar to date, but converts time to Greenwich mean time first.

(4) mktime

Usage:

Mktime (hours, scores, seconds, months, days, and years); returns a time value for other functions.

(5) Time

Usage:

Time (); returns the number of seconds since January 1, January 1, 1970.

(6) microtime

Usage:

Microtime (); returns a string, which is divided into two parts by space. The latter part is equivalent to time ()

The first part is the number of microseconds.

(7) checkdate

Usage:

Checkdate (month, day, year); returns logical truth or logical false. if:

The year is between 1900 and 32767 (including 1900 and 32767 );

The month is between 1 and 12;

The day is within the permitted number of days of the month (considering the leap year );

Returns the logical truth.

(8) set_time_limit

Usage:

Set_time_limit (seconds );

Starting from the running time of the sentenceProgramThe operation must end within the specified number of seconds. If the time-out period ends, the program exits due to an error.

More articles on "php time functions"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/326919.html pageno: 13.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.