tags:

views:

42

answers:

2

I need to make a simple if statement for a daily cron job to check if today is the first saturday of the month. How would I modify the following code to do that instead of just running on the 1st of every month?

if (date("j") == 1) {
    // run cron here
}
+5  A: 

The first saturday of the month is the saturday where the day number is 7 or less.

Sjoerd
Oh yeah, I guess I should take a break :P
James Simpson
And if the normal crontab settings could cope with something like that.... Damned _'on day-of-week and day-of-month we set an OR instead of AND'_ ...
Wrikken
+1  A: 
            if  ((date("D")=="Sat") && (date("j")<=7)){

            }
arunabhdas