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. :) Link to comment https://forums.phpfreaks.com/topic/26197-strtotime-for-the-last-saturday-of-the-month/ 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. Link to comment https://forums.phpfreaks.com/topic/26197-strtotime-for-the-last-saturday-of-the-month/#findComment-119826 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] Link to comment https://forums.phpfreaks.com/topic/26197-strtotime-for-the-last-saturday-of-the-month/#findComment-119828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.