I’m trying to use PHP to create a script that searches all the days between now and one year’s time and lists all the dates for Fridays and Saturdays. I was trying to use PHP’s date() and mktime() functions but can’t think of a way of doing this. Is it possible?
Thanks,
Ben
Here’s how to do it in a cool way, with special thanks to
strtotime‘s relative formats.Of course you should tweak it to do exactly what you want, but that’s beside the point I was trying to make.
Also note that
strtotimewill give you timestamps. To find out the date use:Another thing to know is that
Next <dayofweek>will exclude your current day from the search, so if you also want to include the current day you can do it like this:And here’s a full working script that does exactly what you wanted.
Good luck, Alin