Finding start date of the each week php -
Suppose there are 10 weeks; Week_1st, week_2, week_3th ..., week_10th 2014-05-01 00:00:00 starts at 10-10, how can I get the start date of the week (last week)? Will you show me in php? Thanks a lot.
If you want to go exactly 5 weeks ago (or something else), then try: If you always want to receive Monday (or similar), you can try it $ date = new date time ('2014-05-01'); $ Date-> Modify ('- 5 weeks'); Transcript $ date- & gt; Format ('Y-M-D');
$ date = new dateTime ('2014-05- 01 '); $ Day = (int) $ date- & gt; Format ('w'); $ Date-> Modify ('- 5 weeks'); $ Date-> Modify (1 - $ day. 'Days'); // 1 = echo on Monday $ date- & gt; Format ('Y-M-D');
Comments
Post a Comment