PHP function of the diversification and functional similarity is really a big feature, the same application can be implemented with a variety of functions, which is probably a disadvantage of open source, through the PHP time function of the system learning, fully understand the time stamp and time zone concept (this is really important), the need for small partners to refer to.
All functions in PHP are in the Unix era, starting January 1, 1970.
The date is the number of seconds from this time onwards.
When a function call is counted as the number of seconds from this time, it is treated as a (timestamp) timestamp.
local time function
1. String date (string Format,inieger timestamp)
The function returns a string representing the time, which is controlled by the string format.
Such as:
<?print (Date ("Y year M D Day");//output current, month date. Print (Date ("Y year M D Day", 60*60*24*365*10);//Output January 1, 1980.? >
You might ask, how come there's no timestamp? If the timestamp is empty, or does not write, it means to use the current time moment timestamp.
The control that represents the year: Y---Four-bit year y---two-bit year
The controller that represents the month: M---month name from the month of 1-12 F---English month name m---abbreviated
The control that represents the day number: D---preceded by 0 of the month in the date j--before the day number 0
The week's control: l--English week d--abbreviated week
The control for the hour: h--from 1-12 hours h---from 0 to 23 hours
Represents the last afternoon's control of a---am or pm a---am or pm
The control that represents the minute: I---value 00-59
Indicates the number of days of the Year: z--the number of days of the year
2. Array getdate (integer timestamp)
The function returns a matrix.
Such as:
< $current _date=getdate ();p rint ($current _date ("hours"));p rint ($current _date ("minutes");p rint ($current _date ( "seconds");? >
Description
Element description
Hours hours in 24-hour format
Mday date in month
Minutes min
Mon digital form of month
Month Full Name
Seconds number of seconds
Wday number of weeks from 0 to 6
Weekday name of the week
Year years
0 Timestamp is the number of seconds from January 1, 1970 to the present
Yday date of the year in digital form
3. Boolean checkdate (integer month,integer day,integer year) The function checks whether the date is legal. For example:
<?if (Checkdate (2,29,1980)) print ("date valid!n");? >
4. Integer time ()
The function obtains the current timestamp. such as:
<?print (Time ());//output a large string of integers?>
5. Integer mktime (integer hour,integer minutes,integer seconds,integer month, integer day,integer year)
The function returns the timestamp of the given date, which is the number of seconds from January 1, 1970 to the present.
If a parameter goes out of scope, the function can also interpret it, as 1 March is the January of the second year.
Such as:
< $currenthour =date ("H");p rint ("50 Hours later:");p rint (Date ("H:i A L F ds,y", Mktime ($currenthour +50));p rint ("<br >n ");? >
6. String Microtime ()
The function returns a string that is the number of milliseconds from the current time + space + seconds since 1970
<?print ("Start:microtime () <br>n"); for ($index =0; $index <1000; $index + +) print ("good!"); Print ("Stop:microtime () <br>n");? >
Also, each Linwei standard Time function
Summary : The above is the entire content of this article, I hope to be able to help you learn.
Related recommendations:
How to build an intelligent bar chart program in PHP
PHP implementation method of extracting Chinese and English initial letters
PHP Chinese Round seal class