PHP obtains the current week's Sunday month and year day based on the day of the month

Source: Internet
Author: User
  1. The last Sunday deadline for the date of month and year may cross the moon across the years
  2. function Getclearweek () {
  3. $year _month_day_over = Array ();
  4. $year = Date (' Y '); Four-bit year
  5. $month = Date (' n '); 1 to 12
  6. $day _of_month = Date (' j ');//1-The day of 3 January
  7. $day _of_week = Date (' N '); Day 1-7 of the week
  8. $day _of_year = date (' z ') +1; The first day of 1-366 years
  9. $days _of_month = date (' t '); The number of days that the current month month should be
  10. $day _should_over = $day _of_month-$day _of_week + 7;
  11. if ($day _should_over > $days _of_month) {
  12. $month _over = $month + 1;
  13. if ($month _over > 12) {
  14. $year _month_day_over = Array (
  15. ' Year_over ' + $year + 1, ' month_over ' and ' 1, ' day_over ' and $day _should_over-$days _of_month,
  16. );
  17. } else {
  18. $year _month_day_over = Array (
  19. ' Year_over ' = $year, ' month_over ' + $month + 1, ' day_over ' and $day _should_over-$days _of_month,
  20. );
  21. }
  22. } else {
  23. $year _month_day_over = Array (
  24. ' Year_over ' = $year, ' month_over ' and $month, ' Day_over ' and $day _should_over,
  25. );
  26. }
  27. return $year _month_day_over;
  28. }
Copy Code
Php
  • 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.