Jump to content

Showing dates for next wednesday....


wmguk

Recommended Posts

Hi,

 

I am trying to create a little script to simply display:

 

Next Meeting - Wednesday 10th September 2008

 

but the meetings are every wednesday, so until next tueday I need to show 10th Sept, after tuesday it needs to be the 17th etc etc

 

I currently have

 

<?PHP 
$newDate = strtotime("+7 day", time());
echo date('jS F Y',$newDate) ;
?>

 

but obviously that will display the day in 7 days... not the next wednesay, is there a way?

Link to comment
https://forums.phpfreaks.com/topic/122623-showing-dates-for-next-wednesday/
Share on other sites

Yup you can use "Next Wednesday" as a modifier for the strtotime function.

 

$newDate = strtotime("Next Wednesday", time());
echo date('jS F Y',$newDate);

 

Check out this page for other valid modifiers:

 

http://www.gnu.org/software/tar/manual/html_node/Relative-items-in-date-strings.html#SEC120

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.