# How to query birthday is today

**URL:** <https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188>\
**Category:** JavaScript SDK\
**Created:** [November 17, 2021, 7:49am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188 "2021-11-17T07:49:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shafeekghaseel](https://community.parseplatform.org/user_avatar/community.parseplatform.org/shafeekghaseel/32/913_2.png) [@shafeekghaseel](https://community.parseplatform.org/u/shafeekghaseel)\
**Post date:** [November 17, 2021, 7:49am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/1 "2021-11-17T07:49:57Z")

</div>

I need to get all users those who have birthday today

**Here is my code**  
var user = Parse.Object.extend("\_User");  
var query = new Parse.Query(user);  
query.equalTo(“birthday”,new Date());  
query.find().then(function(results) {

}

---

<div class="post-metadata">

**Author:** ![uzaysan](https://community.parseplatform.org/user_avatar/community.parseplatform.org/uzaysan/32/59_2.png) [@uzaysan](https://community.parseplatform.org/u/uzaysan)\
**Post date:** [November 17, 2021, 8:43am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/2 "2021-11-17T08:43:16Z")

</div>

query.greaterThan(yesterday);  
query.lessThan(tomorrow);

This should work

---

<div class="post-metadata">

**Author:** ![shafeekghaseel](https://community.parseplatform.org/user_avatar/community.parseplatform.org/shafeekghaseel/32/913_2.png) [@shafeekghaseel](https://community.parseplatform.org/u/shafeekghaseel)\
**Post date:** [November 17, 2021, 8:58am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/3 "2021-11-17T08:58:26Z")

</div>

Problem is the year. How can we query a date object without year. My date of birth is ‘01-01-1991’ and i’m querying 2021.

---

<div class="post-metadata">

**Author:** ![uzaysan](https://community.parseplatform.org/user_avatar/community.parseplatform.org/uzaysan/32/59_2.png) [@uzaysan](https://community.parseplatform.org/u/uzaysan)\
**Post date:** [November 17, 2021, 9:16am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/4 "2021-11-17T09:16:30Z")

</div>

Ah you are right. You can use aggregation. Or you can store the birth day and month in a string field. And directly query against that field.

```auto
user = {
 birthDay: "06-11" // Birthday is 6th of November.
}

```

```auto
const today = new Date();
query.equalTo("birthDay",`${today.getDate()}-${today.getMonth() + 1}`);

```

---

<div class="post-metadata">

**Author:** ![shafeekghaseel](https://community.parseplatform.org/user_avatar/community.parseplatform.org/shafeekghaseel/32/913_2.png) [@shafeekghaseel](https://community.parseplatform.org/u/shafeekghaseel)\
**Post date:** [November 17, 2021, 9:29am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/5 "2021-11-17T09:29:04Z")

</div>

Birthday is already stored as date. Can you tell me how to use the aggregation.

---

<div class="post-metadata">

**Author:** ![uzaysan](https://community.parseplatform.org/user_avatar/community.parseplatform.org/uzaysan/32/59_2.png) [@uzaysan](https://community.parseplatform.org/u/uzaysan)\
**Post date:** [November 17, 2021, 9:31am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/6 "2021-11-17T09:31:45Z")

</div>

this is what I found on google

> <https://stackoverflow.com/questions/34614042/how-to-get-list-of-users-whos-birthday-is-today-in-mongodb>

---

<div class="post-metadata">

**Author:** ![baarsofia42](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@baarsofia42](https://community.parseplatform.org/u/baarsofia42)\
**Post date:** [January 4, 2024, 7:59am UTC](https://community.parseplatform.org/t/how-to-query-birthday-is-today/2188/7 "2024-01-04T07:59:58Z")

</div>

Thank you for posting it here. It brightened my day, especially since it’s my birthday, making this thread a delightful [birthday present](https://birthdaycancoolers.net/40th-birthday-koozies/) for me.
