Jump to content

Recommended Posts

Hello. Can somebody have a look at this code? I would like it to return birthdays coming in the next three weeks. At the moment as it is, it does this only up to the end of December when it should also be pulling a birthday in the first week of January. I suspect it has something to do with the removal of the "Y"ear in the date formats but I'm not sure because when I add it back in, it returns nothing. The IF line is the suspected culprit.

 

I'm not asking for someone to write code but simply confirm whether or not the issue falls where I suspect it does and maybe a quick explanation of what's wrong. I need to understand this. Thanks!

 

// there is a column in the database called user_dob

                $user_birthday = date("m-d", strtotime($user_dob));
	$curdate = date("m-d");

	if ($curdate <= date($user_birthday, strtotime("+21 day"))) {

                            code

				}

Link to comment
https://forums.phpfreaks.com/topic/253618-date-comparison-code-assessment/
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.