Jump to content

Timestamp mysql


cordoprod

Recommended Posts

Hello.

I have an issue with my search page.

I always use timestamps from time().

And when the user register, his birthday will be converted to timestamp.

 

But in my search page i have FROM AGE and TO AGE.

 

I get the age from a user like this:

// finne alderen
function alder($timestamp) {
$ageTime = $timestamp; 
$t = time(); 
$age = ($ageTime < 0) ? ( $t + ($ageTime * -1) ) : $t - $ageTime;
$year = 60 * 60 * 24 * 365;
$ageYears = $age / $year;

return floor($ageYears);
}

 

But how does the sql query look like if that is from timestamp and the ages in select is from 0 to 90?

Link to comment
https://forums.phpfreaks.com/topic/144223-timestamp-mysql/
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.