473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need to know how to ignore part of a date in this code

I have this mod for my forum and it calls the birthdate from the database. I would like to have it not see the year. What is happening if a person puts a year in the box in their profile it makes it Dec 31st because that year is already over. There is no way to remove that box from the code according to the forum tech people. I've added the two pieces that refer to date. It already is written where it only shows the month and day in the view. Thank you to anyone that can help.


[PHP]$birthdays = get_birthdays();
if(!$birthdays) {
$text = 'No birthdays yet';
} else {
$num = count($birthdays);

$i = 1;

foreach($birthdays as $b) {
$date = explode("-", $b["user_birthday"]);
$user = get_user($b["user_id"]);
$user_menus[] = create_user_popup($user);
if($date[2] == date('j')) {
$text.= "<img src='" . BASE_DIR . "/birthday.gif' title=\"User's birthday today!\"/>";
$dateprint = '<span style=\'color:red\'><strong>TODAY!</strong></span>';
} else {
$dateprint = date('F jS', mktime(0, 0, 0, $date[1], $date[2], $date[0]));
}
$text .= user_link_code($b["user_id"], $b["user_name"]);
$text .= " (" . $dateprint . ")";
if($num > $i) {
$text .= ', ';
}
$i++;
}

} [/PHP]


[PHP]/**** BEGIN BIRTHDAYS TODAY ****/
function get_birthdays() {
$result = db_query("SELECT user_id, user_name, user_birthday FROM wowbb_users
WHERE DAYOFMONTH(user_birthday) >= DAYOFMONTH(NOW()) AND MONTH(user_birthday) = MONTH(CURRENT_DATE) AND DAYOFMONTH(user_birthday) < DAYOFMONTH(CURRENT_DATE)+7
ORDER BY DAYOFMONTH(user_birthday) ASC;");
while($row = db_fetch_row($result)) {
$birthdays[] = $row;
}
return $birthdays;
}

/**** END BIRTHDAYS TODAY ****/[/PHP]
Jun 11 '07 #1
0 997

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JA | last post by:
I am trying to pull a time stamp out of a database,looks like this 2004-06-24 10:12:03 . Then I need to substring it so that I can take a difference of 2 times. Basically I making a clock...
21
by: Chris Reedy | last post by:
For everyone - Apologies for the length of this message. If you don't want to look at the long example, you can skip to the end of the message. And for the Python gurus among you, if you can...
34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
0
by: =?Utf-8?B?TGV0emRvXzF0?= | last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines, remove some lines based upon a condition in a certain column. Then copy this data into a new spreadsheet and sort the ...
3
by: ClassicNancy | last post by:
I have this mod for my forum and it calls the birthdate from the database. I would like to have it not see the year. What is happening if a person puts a year in the box in their profile it makes it...
8
by: mvdave | last post by:
Hello all & I hope I'm posting in the right place.. I need to load a temporary table with a range of sequential dates, passing it a beginning and an end date from a criteria form. I have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.