I know there is similar post about how to get the last Thursday in PHP but I don't want to have the last Thursday compare to the current date but the last Thursday compare to a given date.
For example I have a date dd/mm/yyyy and I want the Thursday before this date. The input is a String ( the format of the string yymmdd) that I want to parse to get the Thursday before this date.
Thanks for your help
//Assumes it's strtotime parsable, you may need to insert
// slashes with your given format eg (and use 4 digit years)
$given=strtotime($dtstring);
//It's just that easy ;)
$thuBefore=strtotime("last thursday",$given);
Note that this will always get last thursday, meaning if the given date is a Thursday, it'll report 7 days earlier (but if the date's a Friday it'll only report one day earlier).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With