How to use the date and time functions in PHP _php tutorial

Source: Internet
Author: User
(1) Date
Usage:
Date (format, [time]);
If there is no time parameter, the current time is used.
The format is a string in which the following characters have special meanings:
U is replaced by the number of seconds since a starting time (as if it were January 1, 1970)
Y Replace with 4-bit era name.
Y Replace with 2-bit era name.
F Replace the full English name of the month.
M replaced by the abbreviation of the month.
M replaced by the number of months.
Z is replaced by the number of days since January 1 of the year.
D replaces the number of Rewardcash octopus.
L Replace the day of the week with the full English name.
D Replace the English abbreviation of the day of the week.
W replaces the Day of the Week (number).
H is replaced by the number of hours (24-hour system).
H is replaced by the number of hours (12-hour system).
I replace it with the number of minutes.
S is replaced by the number of seconds.
A is replaced with "AM" or "PM".
A is replaced with "AM" or "PM".
S replaces the sequential numeric suffix, for example: "St", "nd", "rd", "th".
The function returns a format string that has been replaced.
(2) getdate (time)
Returns a hash table with each subscript being:
"Seconds"--number of seconds
"Minutes"--Score
"Hours"--Number of hours
"Mday"--Number of days
"Mon"--Number of months
"Year"--era name
"Yday"-the number of days since January 1
"Weekday"--day of the week, English full name
"Month"--month, full name in English
(3) Gmdate
Similar to date, but the time is first converted to Greenwich standard.
(4) Mktime
Usage:
Mktime (hours, fractions, seconds, month, day, year);
Returns a time value that can be used for other functions.
(5) Time
Usage:
Time ();
Returns the number of seconds since zero January 1, 1970.
(6) Microtime
Usage:
Microtime ();
Returns a string separated into two parts, followed by time ()
The first part of the return value is the number of microseconds.
(7) Checkdate
Usage:
Checkdate (month, day, year);
Returns logical TRUE or logical false.
If:
[1] The year between 1900 and 32767 (including 1900 with 32767);
[2] months between 1 to 12;
[3] days within the allowable days of the month (considering leap years);
Returns the logical true.
(8) Set_time_limit
Usage:
Set_time_limit (number of seconds);
Specifies that the program must run at the end of the specified number of seconds from the time the sentence is run.
Timeout the program error exits.

http://www.bkjia.com/PHPjc/445587.html www.bkjia.com true http://www.bkjia.com/PHPjc/445587.html techarticle (1) Date usage: date (format, [time]); If there is no time parameter, the current time is used. The format is a string in which the following characters have special meanings: U Replace with a starting time (OK ...

  • Related Article

    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.