In-depth introduction to PHP Date Format leap year, week, day

Source: Internet
Author: User
Tags echo date

PHP itself is a simple and powerful language, and the PHP date format is quite common. So I studied the PHP date format and will share it with you here, I hope it will be useful to you. PHP has core features such as powerful string and array processing capabilities, and greatly improved support for Object-Oriented Programming (PHP5 and later versions ).

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 parsed XML files. You can also use the C language to write your own PHP extension module. For example, provide a PHP interface function in an existing code library. You can also run PHP In Windows, use COM to control other Windows applications such as Word and Excel, or Use ODBC to connect to the database, next we will introduce the PHP date format in detail.

1, leap year, week, day
Echo date ('l ');
This year's leap year: 0
Echo date ('l ');
Today is: Tuesday
Echo date ('D ');
Today is: Tue
In upper case, L indicates whether this year is a leap year, Boolean value, and 1 is returned for true; otherwise, 0; in lower case, l indicates the day of the week in full (Tuesday ); however, uppercase D is used to represent the three abbreviation of the day of the week (Tue ).
Echo date ('W ');
Today's week: 2
Echo date ('W ');
This week is the second week in the year. The lower case w indicates the day of the week. The upper case W indicates the number of weeks in the year.
Echo date ('T ');
This month is 28 days
Echo date ('Z ');
Today is the 36th day of the year, lowercase t represents the number of days of the current month, and lowercase z represents the day of the year.

2. Others
Echo date ('T ');
UTC
Uppercase T indicates the time zone setting of the server
Echo date ('I ');
0
If I is used to determine whether the current value is success, 1 is returned for true. Otherwise, 0 is returned.
Echo date ('U ');
1170769424
The upper-case u table shows the total number of seconds from January 1, January 1, 1970 to the present, which is the Unix timestamp of the UNIX time era.
Echo date ('C ');
2007-02-06T14: 24: 43 + 00: 00
Lowercase c Represents the ISO8601 date, the date format is YYYY-MM-DD, with the letter T to interval the date and time, the time format is HH: MM: SS, the time zone uses Greenwich Mean Time (GMT).
Echo date ('R ');
Tue, 06 Feb 2007 14:25:52 + 0000
Lowercase r indicates the RFC822 date. The small date () function shows the powerful functions and charm of PHP, and then compares ASP, haha.


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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.