Suppose I have a date available with me:
2011-04-05 (i.e., 5th April, 2011)
I want to find date range for Current Week, Month and Year
Current Week: 3rd April to 9th April Current Month: 1st April to 30 April Current Year: 1st Jan to 31 Dec
I do understand that current year would be always 1st Jan to 31Dec, but what about current month and week, How can I find it?
How can I find date, which is 10 days earlier or later from a given date. Example:
Suppose today's date is 6th April, 2011 10 day's earlier: 28 March, 2011 10 day's later: 15 April, 2011
Any thoughts on this, guys?
you can use strtotime
date('d.m.Y',strtotime('last day of this month')) date('d.m.Y',strtotime('last monday')) // for first day of this week
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki