cjb Posted November 5, 2006 Share Posted November 5, 2006 I'm using the strtotime function to define dates like:$date1 = strtotime("third thursday");How would I use this function to find the last thursday of the month?$date1 = strtotime("last thursday"); gives the timestamp for last thursday instead of the last thursday of the month. Thanks. :) Quote Link to comment Share on other sites More sharing options...
doni49 Posted November 5, 2006 Share Posted November 5, 2006 The post here indicates that it's a way to find the "LAST MONDAY IN AUGUST".You should be able to modify it to suit your needs. Quote Link to comment Share on other sites More sharing options...
doni49 Posted November 5, 2006 Share Posted November 5, 2006 OK I decided to see what I could come up with.[code]<?php$month = date("m") + 1;$year = date("Y");if ($month == 13){ $month = 1; $year++;}echo "<br />Month: " . $month;echo "<br />Year: " . $year;$ld = strtotime("-1 week thursday", strtotime("1-" . $month . "-" . $year)) + 43200;echo "<br />" . date ("F j, Y : D",$ld);?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.