Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7409813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:08:21+00:00 2026-05-29T06:08:21+00:00

I have a database with user birthdays… however, the year is not included. so

  • 0

I have a database with user birthdays… however, the year is not included. so the birthday of a random user would be say 0000-02-03 (feb 3rd). the column would be of datatype “date”

I want to find that user with a select statement, from today… as in if today was 2012-02-03 I’d want to do something like

select * from users where dob = DATE()

is this possible without a year? please inform! thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:08:22+00:00Added an answer on May 29, 2026 at 6:08 am

    This is not as easy as it sounds, as there are leap years, and users having their birthday on 29th February will be returned only in 4 years. It’s better return them on 1st March if the 29th February doesn’t exists in that year. Actually, if you need to be serious about this, you have to take into account, that every 100 years, there’s no leap year, but every 400 there is.

    Here is an answer that property takes into account leap-years and will always give you the users whose birthday is on the 29th of February at the same time as those on the 1st of March.

    SELECT * 
      FROM USERS
      WHERE 
         DATE_FORMAT(FROM_UNIXTIME(birthDate),'%m-%d') = DATE_FORMAT(NOW(),'%m-%d')
         OR (
                (
                    DATE_FORMAT(NOW(),'%Y') % 4 <> 0
                    OR (
                            DATE_FORMAT(NOW(),'%Y') % 100 = 0
                            AND DATE_FORMAT(NOW(),'%Y') % 400 <> 0
                        )
                )
                AND DATE_FORMAT(NOW(),'%m-%d') = '03-01'
                AND DATE_FORMAT(FROM_UNIXTIME(birthDate),'%m-%d') = '02-29'
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database with user 'dbo' that has a login name domain\xzy. How
I have a database with a user 'votes' table and a 'user' table. I'm
I have a database in single user mode and I am trying to drop
I have two tables in my database: user and media_contact . The media_contact table
I have database application, I want to allow the user to restore the deleted
i have a large user Database (13k+), and for some reason i need to
I have a postgres database with a user table (userid, firstname, lastname) and a
I have a database that is stuck in single-user mode. I kill the process
I have a database that hold's a user's optional profile. In the profile I
I have a database table where the user marks files to be downloaded. Subsequently,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.