Local time functions
1. string date (string format, inieger times ***** p)
This function returns a time string controlled by string format.
For example:
The code is as follows: |
Copy code |
<? Print (date ("y, m, d"); // output current, year, month, and day. Print (date ("y, m, d,", 60*60*24*365*10); // output for April 1, January 1, 1980. ?>
|
Maybe you will ask, why is there no times *** p? If times ***** p is null or is not written, the current time is used. times ***** p.
The control operator of the year: y --- four-digit year y --- two-digit year
Indicates the control operator of the month: m --- from month f --- English month name m --- abbreviated month name
Control operator for day: d --- date j in the month with 0 in front -- date without 0 in front
Indicates the control letter of the week: l -- English week d -- abbreviation of the week
The hour controller: h -- hour from 1 to 12 h --- hour from 0 to 23
Indicates the Control Letter a --- am or pm of the previous afternoon.
Indicates the minute controller: I --- value 00-59
The number of days in a year: z -- the number of days in a year
2. array getdate (integer times ***** p)
This function returns a matrix.
For example:
The code is as follows: |
Copy code |
<? $ Current_date = getdate (); Print ($ current_date ("hours ")); Print ($ current_date ("minutes "); Print ($ current_date ("seconds "); ?> |
Note:
Element description
Hour in the 24-hour format
Date in mday month
Minutes
Month in the form of mon
Full name of month
Seconds
The number of weeks in the format of 0 to 6 for wday
Weekday
Year
0 timestamp is the number of seconds from January 1, January 1, 1970 to the present.
A date in the digit format of a year in yday
3. boolean checkdate (integer month, integer day, integer year)
This function checks whether the date is valid. For example:
The code is as follows: |
Copy code |
<? If (checkdate (2, 29, 1980 )) Print ("date is valid! N "); ?> |