Home > Backend Development > PHP Tutorial > Detailed description of php date format_PHP tutorial

Detailed description of php date format_PHP tutorial

WBOY
Release: 2016-07-15 13:22:05
Original
1154 people have browsed it

Detailed description of date format
All functions in PHP are from the Unix era, that is, starting from January 1, 1970. The date is the number of seconds since this time. When a function calls the number of seconds since then, treat it as a (times****p) timestamp.
Local time function
1. string date(string format,inieger times****p)
This function returns a string representing the time, controlled by string format.
Such as:

print(date("y year m month d day");//Output the current year, month and day.
print(date("y year m month d day",60*60*24*365*10);//Output January 1, 1980.
?>
Maybe you will ask, why is there no times****p? If times****p is empty, or does not write a time, it means using the current time times****p.
Control character representing the year: y---four-digit year y---two-digit year
Control character representing the month: m---month from 1-12 f---English month name m---abbreviated month name
The control character representing the day number: d---the day of the month with 0 in front j--the day number without 0 in front
The control character representing the day of the week: l--English week d--abbreviated week
Control character representing the hour: h--hours from 1 to 12 h---hours from 0 to 23
Control symbol indicating morning and afternoon a ---am or pm a---am or pm
Control character representing minutes: i---value 00-59
Indicates 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.
Such as:

<? 
$current_date=getdate(); 
print($current_date("hours")); 
print($current_date("minutes"); 
print($current_date("seconds"); 
?> 
Copy after login


Description:
Element Description
hours Hours in 24-hour format
mday Mid-month date
minutes minutes
mon month in numeric form
month Full name of month
seconds seconds
wday Day of the week as a number from 0 to 6
weekday The name of the day of the week
year year
0 timestamp is the number of seconds from January 1, 1970 to the present
yday Numeric date of the year
3. boolean checkdate(integer month,integer day,integer year)


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/447007.htmlTechArticleDate format details All functions in php are for the unix epoch, that is, starting from January 1, 1970 . The date is the number of seconds since this time. The seconds counted since when a function is called...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template