Jump to content

Date Comparison... Code Assessment


dtyson2000

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

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.