Shell script with php for next Sunday

I’m trying to calculate the next Sunday and it seems like using php in a shell script is the easiest way. This works fine as a php function:


Anyone want to help figure out why this returns nothing?

do shell script ("php -r 'echo date ('m/d/y', strtotime(\"Next Sunday\"));'")

Or, is there a pure Applescript way to determine the next Sunday from the day a script is run?

Thanks

Hi,

How about this?

set myDate to current date
repeat
	if weekday of myDate is Sunday then
		exit repeat
	else
		set myDate to (myDate + 1 * days)
	end if
end repeat
(short date string of myDate)

Best wishes

John M

That works great, thanks! Much simpler than the shell script for what I need.- Mark