The date () function of PHP determines today's Day of the week

Source: Internet
Author: User
Tags iso 8601 iso 8601 format

Day of the D month, 2 digits with leading zeros 01 to 31

The day of the D-week, the text says, 3 letters Mon to Sun

Day of the J month, without leading 1 to 31

L (Lowercase letter of "L") Day of the week, full text format Sunday to Saturday

N ISO-8601 format number represents the day of the week (PHP 5.1.0 new Plus) 1 (Monday) to 7 (Sunday)

S English suffix, 2 characters st,nd,rd or th, after the number of days per month. Can be used with J.

The day of the W week, the number represents 0 (Sunday) to 6 (Saturday)

Days 0 to 366 in the Z-year

The week of the year in W ISO-8601 format, starting from Monday (PHP 4.1.0 New) 42 (42nd Week of the year)

F month, full text format, such as January or March January to December

The month represented by the m number, with a leading 1 to 12

M three-letter abbreviation for month Jan to Dec

n number of months, without leading 1 to 12

t the number of days that a given month should be 28 to 31

L is a leap year if the leap year is 1, otherwise 0

o ISO-8601 format year number.

Y 4-digit year full representation for example: 1999 or 2003

Y 2 digits indicate the year for example: 99 or 03

A lowercase morning and afternoon value am or PM

A uppercase morning and afternoon value am or PM

B Swatch Internet Standard 000 to 999

G-hour, 12-hour format, without leading 1 to 12

G-hour, 24-hour format, without leading 00 to 23

H-hour, 12-hour format, with leading 1 to 12

H-hour, 24-hour format, with leading 000 to 23

I have a leading zero minute number 00 to 59>

S number of seconds, with leading 000 to 59>

E Time zone identifier (PHP 5.1.0 new) Example: Utc,gmt,atlantic/azores

I is daylight saving time if daylight saving time is 1, otherwise 0

O hours of difference from GMT for example: +0200

The difference between P and GMT (GMT) is separated by a colon between hours and minutes for example: +02:00

T the time zone where the machine is located

The number of seconds to offset the Z-time difference. The time zone offset in the west of UTC is always negative, and the east of UTC is positive. 43200 to 43200

Date in C ISO 8601 format (PHP 5 new Plus) 2004-02-12t15:19:21+00:00

R RFC 822 Format date For example: Thu, 2000 16:01:07 +0200

The number of seconds since the beginning of the Unix era (January 1 1970 00:00:00 GMT) time () get timestamp

PHP's date () function is very powerful, through the above parameters can achieve a lot of date operation, such as get the above I marked the red parameter description to achieve today is the day of the week operation!

Operation with "W" Parameter: PHP code is as follows:


  
 
  1. <? PHP
  2. $weekarray = Array ("Day","One","Two","three","four" ,"Five","six");
  3. Echo "Week" . $weekarray [date("W")];
  4. ?>
    Source: >  


From for notes (Wiz)

The date () function of PHP determines today's Day of the week

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.