Home  >  Article  >  Backend Development  >  An in-depth introduction to PHP date formats for leap years, days of the week, and days_PHP Tutorial

An in-depth introduction to PHP date formats for leap years, days of the week, and days_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:27:371141browse

PHP itself is a simple and powerful language, and the PHP date format is quite commonly used, so I studied the PHP date format and shared it with you here. I hope it will be useful to everyone. The PHP language has core features such as powerful string and array processing capabilities, and has greatly improved support for object-oriented programming (PHP5 and above).

By using standard and optional extension modules, PHP applications can connect to more than a dozen databases such as MySQL or Oracle, draw, create PDF files and create Parse XML files. You can also use C language to write your own PHP extension module. For example, provide a PHP interface function in an existing code base. You can also run PHP under Windows, use COM to control other Windows applications such as Word and Excel, or use ODBC to connect to the database. Let's introduce PHP date format in detail below.

1, leap year, week, day
echo date('L');
Whether this year is a leap year: 0
echo date('l');
Today is: Tuesday
echo date('D');
Today is: Tue
Capital L indicates whether this year is a leap year, Boolean value, returns 1 if true, otherwise 0; lowercase l indicates Today is the full English version of the day of the week (Tuesday); and a capital D is used to represent the 3-character abbreviation of the day of the week (Tue).
echo date('w');
Today's week: 2
echo date('W');
This week is the 06th week of the year. The lowercase w represents the day of the week in numeric form means that a capital W represents the number of weeks in the year.
echo date('t');
This month has 28 days
echo date('z');
Today is the 36th day of this year. The lower case t represents the number of days in the current month. A lowercase z indicates the day of the year today is.

2, others
echo date('T');
UTC
uppercase T represents the time locale of the server
echo date('I' );
0
Capital I means to determine whether it is daylight saving time, if true, return 1, otherwise 0 The total number of seconds from January 1st to the present is the UNIX timestamp of the Unix time epoch.
echo date('c');
2007-02-06T14:24:43+00:00
Lowercase c represents the ISO8601 date, the date format is YYYY-MM-DD, separated by the letter T Date and time, the time format is HH:MM:SS, and the time zone is expressed using the offset from Greenwich Mean Time (GMT).
echo date('r');
Tue, 06 Feb 2007 14:25:52 +0000
Lowercase r represents the RFC822 date. The small date() function shows the power and charm of PHP. Compare it to ASP, haha.



http://www.bkjia.com/PHPjc/446508.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446508.htmlTechArticlePHP itself is a simple and powerful language. The PHP date format is quite commonly used, so I did some research. PHP date format, I will share it with you here, I hope it will be helpful to everyone...
Statement:
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