PHP multi-dimensional array, date and time: PHP multi-dimensional array and date and time functions: Traversing two-dimensional array vehicle brand inventory sales; f traversing two-dimensional array
Automobile brandInventorySales volume"; For ($ I = 0; $ I
"; For ($ j = 0; $ j
". $ Arr [$ I] [$ j]."";} Echo"";} Echo"";?>
Date and time functions date ()
Date and time are stored as timestamps in PHP. only the date () function can be used to convert to the readable mode.
Syntax: date (format, timestamp); omitting the second parameter defaults to the current time
Format classification:
- Y indicates the year in four digits, for example, January 1, 2015.
- M indicates the month in a year.
- D indicates the day of the month.
- L indicates the day of the week
Other characters such as-,., and/can increase the readability of the date.
Output Current date:
";ehco date('Y.d.m h:i:s')."
";echo date('Y/d/m h:i:s')."
";?>
Time format:
- H is in the 12-hour format with the leading 0 and returns the current hour.
- I has a leading 0 minutes and returns the current minute
- S with the leading 0 s, returns the current S
- A lowercase English morning and afternoon (am, pm)
Note: The date () in PHP returns the current date and time of the server by default when the second parameter. it may be different from the time in the client browser, which may be because the time zone of the server and client is different.
Date_defaut_timezone_set () can be used to set the time zone.
In PHP, you can use the time () function to obtain the timestamp of the current time, or you can use the mktime () function to convert a certain date to a timestamp, this function returns the Unix timestamp of the date. The Unix timestamp contains the number of seconds between the Unix epoch (January 1, 1970 00:00:00 GMT) and the specified time.
Syntax: mktime (hours, minutes, seconds, months, days, and years );
The strtotime () function of PHP can convert our readable string into a timestamp.
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The preceding section describes the PHP multi-dimensional array and date and time functions, including the PHP multi-dimensional array and date and time content. if you are interested in the PHP Tutorial, please help.