Given a date MM-dd-yyyy
format, can someone help me get the first day of the week?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Another way to do it....
Keep it simple :
Source : PHP manual
How about this?
You have to get next monday first then get the 'last monday' of next monday. So if the given date is monday it will return the same date not last week monday.
I found this solution helpful. Just subtract if it isn't monday to get the previous Monday. I am using $lower_date as the date I pulled from a query that I then need to reconcile to the previous Monday.
Replace time(). Next sunday/last monday methods won't work when the current day is sunday/monday.