Sep 04, 2021 07:12 AM
I am new to Airtable and Formulas
I saw a post by Florian_Kleinicke
Who said he had managed something similar, could someone please explain how I use the formula below.
DATETIME_DIFF(DATETIME_FORMAT({Birthday},‘MM-DD’),DATETIME_FORMAT(TODAY(),‘MM-DD’),‘days’)
My problem (which is likely is also a problem here) is that TODAY() won’t update on its own. It stays the same for a while.
Is there a solution to that problem?
I’m using automations to send an email, once the computed difference hits 0.
Ah I just came um with a solution, that might circumvent that problem. I can compute the birthday
DATETIME_PARSE(DATETIME_FORMAT({Birthday},‘MM-DD’),‘MM-DD’)
Sep 04, 2021 07:19 AM
Formulas is not yet my great trip,
but it seems to me that this post
could help you to achieve your goal, with or without formula.
olπ
Sep 04, 2021 10:56 AM
what do you mean computed difference hits 0?
executive summary email will not do as you have to create a calendar base which is separate from my CRM base.
PSN
Sep 04, 2021 11:13 AM
Try this:
DATETIME_FORMAT(Birthday, "MMDD") = DATETIME_FORMAT(TODAY(), "MMDD")
That will output a 1 when the month and date of the birthday match the current day, and a 0 at all other times. It’s worth noting, though, that TODAY()
is based on the current date in GMT, not your local timezone. Depending on where you live, there will probably be some crossover, but it’s going to change at a time other than midnight in your local timezone unless you also live in GMT.
One way around that is to use NOW()
instead, and wrap that in SET_TIMEZONE()
to force it to your local timezone before formatting. Here’s an example using my local timezone:
DATETIME_FORMAT(Birthday, "MMDD") = DATETIME_FORMAT(SET_TIMEZONE(NOW(), "America/Los_Angeles"), "MMDD")
You can find other timezone specifiers here:
Sep 04, 2021 12:38 PM
Sep 04, 2021 02:26 PM
Thanks a lot @Justin_Barrett !
Sorry @Phillip_Silk-Neilsen , just coming back now but I do not have better than Justin’s solution !
olπ
Sep 04, 2021 05:10 PM
@Olpy_Acaflo Have it working now.
For any other newbies the steps are:
Thanks to @Justin_Barrett for the correct formula.
Sep 04, 2021 05:53 PM
@Justin_Barrett Just another quick question in the following formula is there a way that if {Partner Date of Birth} is blank it always returns a 0?
DATETIME_FORMAT({Partner Date of Birth}, “MMDD”) = DATETIME_FORMAT(TODAY(), “MMDD”)
this is because if a client in the base is single, they will not have a partner
Sep 04, 2021 06:49 PM
Yes. Wrap the first part of that formula in an IF()
function so that it’s only executed if {Partner Date of Birth}
isn’t empty:
IF({Partner Date of Birth}, DATETIME_FORMAT({Partner Date of Birth}, "MMDD")) = DATETIME_FORMAT(TODAY(), "MMDD")
If there’s no partner date of birth, that IF()
function will return an empty string, which won’t match the formatted version of TODAY()
, meaning the field will output a 0.
Sep 04, 2021 07:04 PM
@Justin_Barrett Thanks a million
Jan 02, 2023 06:27 AM
Oh, I remember I wanted to do this too! However, I don’t remember the exact formula, because I made it too complicated….
Jan 02, 2023 06:41 AM
I had a crazy idea to make Airtable notify me the week before somebody’s birthday, so I could order a gift basket with flowers and candies. Anyways, you should probably use an if-cycle. For example, the formula could look like this: if the date of today corresponds with somebody’s birthday => send a birthday email. It should not be hard.
May 19, 2023 01:27 AM
Hello,
maybe I am late on the question.
Why not use a View called "Today birthdays" and automate on the event "When record enters view"?
Or you can make an automation that starts at midnight for example where "Birthday Date" field is equal to "today".