Click to See Complete Forum and Search --> : Date to timestamp


tripwater
06-30-2004, 12:41 PM
I have a mysql table that holds a date field ("Y-m-d") format.

This is a birthday.

I would like to select all of the dates in the system and as I loop through, check to see if any are within a week away so I can announce it in a section of the site.


I do not want to convert my field to a unix timestamp because of the work involved changing other things like my calendar script.

I would like to know if I should query for the info and use php functions to convert to timestamp then compare with today's day to see if it is within a week OR handle the conversion in mysql?

Any ideas on the best way to go about this?

Thanks

96turnerri
06-30-2004, 09:19 PM
try something like

$sql = "SELECT name FROM table WHERE dob=date(\"Y-m-d\")";

tripwater
07-01-2004, 09:42 AM
That is not exactly what I had in mind. I am trying to get the difference between now and future dates for eveyone in the table and if they are within a weeks time, display their names on a page to announce their B-days are coming up

I am not going to try to do this in a query now, I have my dates. And I want to calculate via php.

I have posted another topic for this.