PHP returns an odd and even number of php statements every Saturday.
Requirement description: determines whether a week is a double week or a single week based on the Saturday date. that is, if the date on Saturday is a singular number, this week is a single break. if it is a double number, it is a double break. We didn't take into account the different days of each month before, which leads to inaccurate judgment. after modification, it is now accurate. For example, PHP obtains the code for php to judge the odd and even numbers every Saturday.
- $ Ts = date ('t'); // get the total number of days of the month
- $ Rq = date ('D'); // get the date of today
- $ Xq = date ('w'); // Obtain the day of the week. 1-6 indicates the day of the week. 1-6 indicates the day of the week. 0 indicates the day of the week.
- // Calculate the number of days from Saturday
- If ($ xq = 6 ){
- $ Date1 = 0;
- } Else if ($ xq = 0 ){
- $ Date1 =-1;
- } Else {
- $ Date1 = 6-$ xq ;}
- // Use the current date plus the number of days from Saturday
- $ Rq = $ rq + $ date1;
- // Compare with the total number of days of the month
- If ($ rq <= $ ts ){
- $ Rq = $ rq;
- } Else if ($ rq> $ ts ){
- $ Rq = $ rq-$ ts;
- } Else {
- $ Rq = $ date1;
- } Bbs.it-home.org
- // Obtain the date on Saturday after calculation, and then judge the odd and even numbers of dates.
- $ A = $ rq;
- $ A = $ a % 2;
- If ($ a = 0 ){
- Echo 'Saturday: '. $ rq.', this week is a two-week ';
- }
- Else {
- Echo 'Saturday is: '. $ rq.', this week is a week ';
- }
- ?>
|