Use php to obtain the date of this week, next week, this month, next month, and this quarter (abstract)

Source: Internet
Author: User
Use php to obtain the echodate ("Ymd", strtotime ("now"), and "\ n ";?? Echodate ("Ymd", strtotime ("-1 weekMonday"), "\ n ";?? Echod uses php to obtain this week, last week, this month, last month, and this quarter date (abstract)

Echo date ("Ymd", strtotime ("now"), "\ n ";?? Echo date ("Ymd", strtotime ("-1 week Monday"), "\ n ";?? Echo date ("Ymd", strtotime ("-1 week Sunday"), "\ n ";?? Echo date ("Ymd", strtotime ("+ 0 week Monday"), "\ n ";?? Echo date ("Ymd", strtotime ("+ 0 week Sunday"), "\ n ";?????? // What month is the date ('N ?? // Date ("w") what is the week of the week ?? // Date ("t") number of days this month ???? Echo'
Last week:
';?? Echo date ("Y-m-d H: I: s", mktime (0, 0, 0, date ("m"), date ("d ") -date ("w") + 1-7, date ("Y"), "\ n ";?? Echo date ("Y-m-d H: I: s", mktime (23, 59, 59, date ("m"), date ("d ") -date ("w") + 7-7, date ("Y"), "\ n ";?? Echo'
This week:
';?? Echo date ("Y-m-d H: I: s", mktime (0, 0, 0, date ("m"), date ("d ") -date ("w") + 1, date ("Y"), "\ n ";?? Echo date ("Y-m-d H: I: s", mktime (23, 59, 59, date ("m"), date ("d ") -date ("w") + 7, date ("Y"), "\ n ";???? Echo'
Last month:
';?? Echo date ("Y-m-d H: I: s", mktime (0, 0, 0, date ("m")-1,1, date ("Y"), "\ n ";?? Echo date ("Y-m-d H: I: s", mktime (23, 59, 59, date ("m ")?, 0, date ("Y"), "\ n ";?? Echo'
This month:
';?? Echo date ("Y-m-d H: I: s", mktime (0, 0, 0, date ("m"), 1, date ("Y"), "\ n ";?? Echo date ("Y-m-d H: I: s", mktime (23, 59, 59, date ("m"), date ("t "), date ("Y"), "\ n ";???? $ GetMonthDays = date ("t", mktime (0, 0, 0, date ('N') + (date ('N')-1) % 3, 1, date ("Y"); // Number of days before the last December January in the current quarter ?? Echo'
This quarter:
';?? Echo date ('Y-m-d H: I: S', mktime (0, 0, 0, date ('N')-(date ('N ') -1) % 3, 1, date ('Y'), "\ n ";?? Echo date ('Y-m-d H: I: S', mktime (, 59, date ('N') + (date ('N')-1) % 3, $ getMonthDays, date ('Y'), "\ n ";?

This article from The CSDN blog, reproduced please indicate the source: http://blog.csdn.net/mlks_2008/archive/2009/08/05/4411053.aspx

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.