DATEDIFF using mysql-php, it simple
Posted: Mon Jan 01, 2007 7:31 am
Hello experts,
i have following query with me,
"SELECT floor(datediff(CURDATE(), usr.birth_date))/365) as age FROM user_details as usr
Which gives me the number of days between current date and user birth date. Am dividing the result by 365, and get floor() of it.
NOW THE PROBLEM is:
AM dividing the result by 365 blindly, without keep in mind that, thare may be leap year in between this (leep year have 365 days). Since it gives me wrong result (with difference of 5 days).
Please reply,
Am waiting for it.
Thanks n regards,
paresh@panaceatek.com
i have following query with me,
"SELECT floor(datediff(CURDATE(), usr.birth_date))/365) as age FROM user_details as usr
Which gives me the number of days between current date and user birth date. Am dividing the result by 365, and get floor() of it.
NOW THE PROBLEM is:
AM dividing the result by 365 blindly, without keep in mind that, thare may be leap year in between this (leep year have 365 days). Since it gives me wrong result (with difference of 5 days).
Please reply,
Am waiting for it.
Thanks n regards,
paresh@panaceatek.com