This article introduces the specific usage of date and time functions in PHP, with the reference of interested friends. This paper mainly introduces the use of date, GETDATE, Mktime, checkdate and other dates and time functions. (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 a special meaning: U is replaced with a number of seconds from a start time (as if it were January 1, 1970) and Y is replaced with a 4-bit era name. Replace with 2-bit era name. F Replace the full English name of the month. M replaced by the abbreviation of the month. M is replaced by the number of months. Z is replaced by days since January 1 of the year. D replaces the Rewardcash Octopus number. L Replace the day of the week with the full name of the English language. D Replace the English abbreviation for 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 is replaced by the number of minutes. S is replaced by seconds. A replace with "AM" or "PM". A is replaced by "AM" or "PM". S replaces the sequential numeric suffix, for example: "St", "nd", "rd", "th". The function returns the 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"-Days since January 1 "weekday"--day of the week, English full name "M Onth "--month, full name in English(3) Gmdate is similar to date, but first converts the time 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 that is divided into two parts with a space, followed by the return value of time (), and the first part is the number of microseconds. (7) Checkdate usage: checkdate (month, day, year); Returns logical TRUE or logical false. if: [1] years between 1900 and 32767 (including 1900 and 32767); [2] months between 1 to 12; [3] The day is within the allowable number of days of the month (considering a leap year); Returns the logical true. (8) Set_time_limit usage: set_time_limit (seconds); Specifies that the program must run at the end of the specified number of seconds from the time the sentence is run, and the program exits with an error. |