Jump to content

newb - how to easily find out what date a day falls on...?


Bansaw

Recommended Posts

What is the easiest way of finding out in php what date a certain day falls on?

 

ie:  I want to know what date is the 3rd Thursday of every month.

 

for example,  this month would be "

The third Thursday of this month falls on :  18th November  "

 

Whats the best way of doing that in php?

 

Thanks,,

 

You might try the date() function along with the mktime() function.

 

Something like this:

echo date("D", mktime(0, 0, 0, date('m'), date('d')+7, date('Y'))); //show next weeks day

 

I would first figure out what day today is, then how many more day's till thursday, then start displaying the answer with code like the above.

 

Sorry I don't have time to post more, but later if you still need help let me know.

thanks, thats helpful.

 

My website has an event on the 3rd Thursday of every month.  So I want to code something that runs once a day and updates the website.

 

I think my logic could go something like this:

 

1)  Find out what current month is

2) Find out what date  the 3rd Thursday falls on in our current month

3) If current date <= 3rdThursday_of_current_month  then  display "Be ready, our next event is Thursday 18th November"

Else If current date > 3rdThursday_of _current_month display "Be ready, our next event is Thursday 16th December"

 

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.