Last active
June 22, 2024 12:13
-
-
Save abenevaut/4f48d4e849f469b65b47 to your computer and use it in GitHub Desktop.
Get age of user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Not enough precise /!\ | |
DATEDIFF(CURRENT_DATE, `users`.`birthday`)/365 AS age | |
-- Working fine | |
DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), `users`.`birthday`)), "%Y")+0 AS age |
Author
abenevaut
commented
Jun 22, 2024
•
- https://onecompiler.com/mysql/42gykzgu5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment