Page 1 of 1

Grabbing month/day out of a date field.

Posted: Fri Jan 30, 2004 2:08 pm
by Zamees
I'm attempting to get everyone who has a birthday.

My code runs a SQL statement where it tries to grab the month and day from the age field.

when i do

WHERE age = '2000-01-30"'

It returns results

How do I return all results WHERE age = '01-30'

I tried stristr(age,'01-30')
and substr(age,5,5)

But both of those return nothing. So whats the correct way to do this?

Posted: Fri Jan 30, 2004 2:10 pm
by John Cartwright
I just answered something very similar to this.

viewtopic.php?t=17453

Posted: Fri Jan 30, 2004 2:11 pm
by markl999
Try :
WHERE age LIKE '%-01-30' in the query ?

Posted: Sat Jan 31, 2004 10:15 am
by twigletmac
Or you can do:

Code: Select all

WHERE DAYOFMONTH(age) = DAYOFMONTH(NOW()) AND MONTH(age) = MONTH(NOW())
Mac