Jump to content

Next Sunday


johnnyk

Recommended Posts

Is there an easy way to get the date of next Sunday (or Monday or whatever).

I'm thinking I could use a conditional to determine what day it is currently, and add seconds accordingly, then use adjusted date function - but is there anything better that I can do using PHP or MySQL functions?
Link to comment
Share on other sites

try:
[code]<?php echo date('F j, Y',strtotime('next Sunday')); ?>[/code]
or
[code]<?php echo date('F j, Y',strtotime('this Sunday')); ?>[/code]
Sometimes PHP thinks that "this Sunday" and "next Sunday" are different, so see which one works for you.

Ken
Link to comment
Share on other sites

Thanks alot kenrbnsn. But what do you mean about the this Sunday and next Sunday thing?

pixy, that's just MySQL, and they would only work if I determine what day it currently is first.

Also, is there a way to get 2 sundays from now. I'm using MySQL to select anything that is in between the upcoming sunday and a week from that (or "Sunday to a week from Sunday"). I don't need the SQL or anything, but how would I get "a week from Sunday" using strtotime()?
Link to comment
Share on other sites

[quote author=johnnyk link=topic=100641.msg397535#msg397535 date=1152936664]Also, is there a way to get 2 sundays from now....but how would I get "a week from Sunday" using strtotime()?
[/quote]

I'd look at the date() and strtotime() functions in the manual.  This is php help, not php helpless :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.