second friday of this month

liderbug

New member
Code:
$dowa=array( "monday"=>"MO", "tuesday"=>"TU", "wedesday"=>"WE", "thursday"=>"TH", "friday"=>"FR","saturday"=>"SA", "sunday"=>"SU");
$woma = array ("", "first", "second", "third", "fourth", "fifth");
Working with Google Calendar. The downloaded ics file gives a start date of 3 years ago along with the following line

RRULE:FREQ=MONTHLY;BYDAY=2FR -[ so second Friday of the month. ]

To convert BYDAY to Y/m/d H:i for local web display I "$wom = ($woma[substr ($d3[1], 0, 1)]);"
so wom = "second".
Now I do an array_search "FR" and I get the word friday. So far everything works as I want.
So I need "strtotime('second friday of this month')"

Then I code $ts = date('U', strtotime('$wom $dow of this month'); - it returns "0"

If I first run $wd = sprintf ("%s %s of this month", $wom, $dow); [week of month, day of week]
then
$ts = date('U', strtotime($wd); returns 1712964600 which is correct

I've tried single quotes, double quotes, no quotes - no joy. I'm thinking that's just the way it is.
 
Back
Top