blasterstudios
Technical User
If i store my dates as Unix timestamps, how can i pull the records and separate the month, day, and year values. Basically I need their name, age, and month/day of the birthday. I also need 1 filter in there that checks if the birthday has been approved by an admin yet (approved=1). My field names are name, dob, and approved.
I found some script that may help but there are some parts that I don't know what's going on to know what to change:
the first part that messes up is the $option-> part. I do not have a variable called $option. I guess the script where I found this did. If that is for how long I want the days set to, i'd like for it to be 45 days. Anybody understand this enough to know how to change it?
I also want to sort ascending starting with today (which is a variable - $today). This is basically to get upcoming birthdays. Thanks for any help.
I found some script that may help but there are some parts that I don't know what's going on to know what to change:
Code:
SELECT name, approved, DATE_FORMAT(dob, '%M %e, %Y') AS birthday, MONTHNAME(birthday) AS month, DAYOFMONTH(birthday) AS day, YEAR(birthday) AS year, (YEAR(NOW()) - YEAR(birthday) + (RIGHT(CURRENT_DATE,5)>RIGHT(birthday,5))) AS age, (TO_DAYS((birthday + INTERVAL (YEAR(CURRENT_DATE)-YEAR(birthday) + (RIGHT(CURRENT_DATE,5)>RIGHT(birthday,5))) YEAR)) - TO_DAYS(CURRENT_DATE)) as daysAway FROM df_birthdays WHERE birthday != '' AND (TO_DAYS((birthday + INTERVAL (YEAR(CURRENT_DATE)-YEAR(birthday) + (RIGHT(CURRENT_DATE,5)>RIGHT(birthday,5)) ) YEAR)) - TO_DAYS(CURRENT_DATE)) < $option->bdayInterval AND approved = 1 ORDER BY daysAway ASC, age DESC
the first part that messes up is the $option-> part. I do not have a variable called $option. I guess the script where I found this did. If that is for how long I want the days set to, i'd like for it to be 45 days. Anybody understand this enough to know how to change it?
I also want to sort ascending starting with today (which is a variable - $today). This is basically to get upcoming birthdays. Thanks for any help.