MySQL get users birthday

David Carr

Tutorials PHP & MySQL

Here's a simple way to select all birthdays for the current date, where the date of birth is stored in a MySQL database in a DATE format, in this examples a column called 'dob' is used.

SELECT username FROM users WHERE MONTH(dob) = MONTH(NOW()) AND DAY(dob) = DAY(NOW())

This will select all users that have a date of birth matching the current month and day the year is ignored.

Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!

Sponsor

My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.