php date processing code

WBOY
Release: 2016-07-25 08:42:26
Original
903 people have browsed it
  1. echo "
    ";
  2. echo date("Y-m-d",strtotime("now")), "n";
  3. echo "
    ";
  4. echo date("Y-m-d",strtotime("-1 week Monday")), "n";
  5. echo "
    ";
  6. echo date("Y-m-d",strtotime("-1 week Sunday")), "n";
  7. echo "
    ";
  8. echo date("Y-m-d",strtotime("+0 week Monday")), "n";
  9. echo "
    ";
  10. echo date("Y-m-d",strtotime("+0 week Sunday")), "n";
  11. echo "
    ";
  12. echo "*********第几个月:";
  13. echo date('n');
  14. echo "
    ";
  15. echo "*********本周周几:";
  16. echo date("w");
  17. echo "
    ";
  18. echo "*********本月天数:";
  19. echo date("t");
  20. echo "
    ";
  21. echo '
    上周:
    ';
  22. echo date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1-7,date("Y"))),"n";
  23. echo date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7-7,date("Y"))),"n";
  24. echo "
    ";
  25. echo '
    本周:
    ';
  26. echo date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"))),"n";
  27. echo date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"))),"n";
  28. echo "
    ";
  29. echo '
    上上月:
    ';
  30. echo date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m")-2,1,date("Y"))),"n";
  31. echo date("Y-m-d H:i:s",mktime(23,59,59,date("m")-1,0,date("Y"))),"n";
  32. echo "
    ";
  33. echo '
    上月:
    ';
  34. echo date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m")-1,1,date("Y"))),"n";
  35. echo date("Y-m-d H:i:s",mktime(23,59,59,date("m") ,0,date("Y"))),"n";
  36. echo "
    ";
  37. echo '
    本月:
    ';
  38. echo date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),1,date("Y"))),"n";
  39. echo date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("t"),date("Y"))),"n";
  40. echo "
    ";
  41. echo "
    ";
  42. $season = ceil((date('n'))/3)-2;//上季度是第几季度
  43. echo '
    上上季度:
    ';
  44. echo date('Y-m-d H:i:s', mktime(0, 0, 0,$season*3-3+1,1,date('Y'))),"n";
  45. echo date('Y-m-d H:i:s', mktime(23,59,59,$season*3,date('t',mktime(0, 0 , 0,$season*3,1,date("Y"))),date('Y'))),"n";
  46. echo "
    ";
  47. echo "
    ";
  48. $season = ceil((date('n'))/3)-1;//上季度是第几季度
  49. echo '
    上季度:
    ';
  50. echo date('Y-m-d H:i:s', mktime(0, 0, 0,$season*3-3+1,1,date('Y'))),"n";
  51. echo date('Y-m-d H:i:s', mktime(23,59,59,$season*3,date('t',mktime(0, 0 , 0,$season*3,1,date("Y"))),date('Y'))),"n";
  52. echo "
    ";
  53. echo $season = ceil((date('n'))/3);//当月是第几季度
  54. echo '
    本季度:
    ';
  55. echo date('Y-m-d H:i:s', mktime(0, 0, 0,$season*3-3+1,1,date('Y'))),"n";
  56. echo date('Y-m-d H:i:s', mktime(23,59,59,$season*3,date('t',mktime(0, 0 , 0,$season*3,1,date("Y"))),date('Y'))),"n";
  57. $season = ceil((date('n'))/3)+1;//当月是第几季度
  58. echo '
    下季度:
    ';
  59. echo date('Y-m-d H:i:s', mktime(0, 0, 0,$season*3-3+1,1,date('Y'))),"n";
  60. echo date('Y-m-d H:i:s', mktime(23,59,59,$season*3,date('t',mktime(0, 0 , 0,$season*3,1,date("Y"))),date('Y'))),"n";
  61. echo "
    ";
  62. ?>
复制代码

php


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template