I'm building a website for local events. One of the categories is called "What's on this Saturday". Is there any easy way I can do to find the date with PHP?
Thanks.
chrisjoha
9:51 am on Dec 7, 2005 (gmt 0)
I'm sure there's better ways to do it, but this quick code will work most of the time:
Using the date function: echo date("Y-m-d", strtotime("next Saturday"));
or:
echo date("j F Y", strtotime("next Saturday"));
etc etc
dc
bajingan
2:02 am on Dec 9, 2005 (gmt 0)
Thank you! Yes it works! Actually I changed the string from "next Saturday" to "this Saturday" because "next Saturday" gives a date of 2 Saturdays from today while "this Saturday" gives the incoming one.
Thanks.
dreamcatcher
2:31 am on Dec 9, 2005 (gmt 0)
Ok, cool. Strange as next Saturday gives me this Saturday. Must be a server thing.