Php date format description (1/2)

Source: Internet
Author: User
Tags current time getdate local time month name string format

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 ");

Element description
Hour in the 24-hour format
Date in mday month
Month in the form of mon
Full name of month
The number of weeks in the format of 0 to 6 for wday
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 ");



Homepage 1 2 Last page
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.