I was wondering if it was possible to query customers whose birthday is today using their date of birth field (date field).
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello @RyanMoravick ,
Assuming you're referring to running this query in Query Service, there are two out-of-the-box fields under the person
field group for birth date: birthDayAndMonth
and birthDate
.
Since you're asking about the date field, I believe you are referring to birthDate
.
If your birth date data is stored in the birthDate
field, you can use the following query to get customers whose birthday is today:
SELECT *
FROM table_name
WHERE TO_CHAR(person.birthDate, 'MM-DD') = TO_CHAR(CURRENT_DATE, 'MM-DD');
This query formats both the birthDate
and CURRENT_DATE
as MM-DD
(month and day) and compares them to return the customers whose birthday is today.
Kr,
Parvesh
Hello @RyanMoravick ,
Assuming you're referring to running this query in Query Service, there are two out-of-the-box fields under the person
field group for birth date: birthDayAndMonth
and birthDate
.
Since you're asking about the date field, I believe you are referring to birthDate
.
If your birth date data is stored in the birthDate
field, you can use the following query to get customers whose birthday is today:
SELECT *
FROM table_name
WHERE TO_CHAR(person.birthDate, 'MM-DD') = TO_CHAR(CURRENT_DATE, 'MM-DD');
This query formats both the birthDate
and CURRENT_DATE
as MM-DD
(month and day) and compares them to return the customers whose birthday is today.
Kr,
Parvesh
Thank you @Parvesh_Parmar this is exactly what I needed!
Views
Replies
Total Likes
Views
Likes
Replies