# Automation to press button with time based formula

**URL:** <https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915>\
**Category:** Ask the Community\
**Created:** [January 15, 2019, 9:06pm UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915 "2019-01-15T21:06:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [January 15, 2019, 9:06pm UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/1 "2019-01-15T21:06:19Z")

</div>

I have a button on a table that sends out an email to specified users.

I want the button to be pressed automatically _if and only if_ the current date is within two weeks of a target date (two weeks away).

Anybody know how to do this?

Screen shot attached!

 ![CODA%20Screen%20Shot](https://global.discourse-cdn.com/coda1/original/2X/4/4d20fe064d5152bb6841fc8a400580a8a3842a61.jpeg)

---

<div class="post-metadata">

**Author:** ![Daniel\_Stieber](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/daniel_stieber/32/17045_2.png) [@Daniel\_Stieber](https://connect.superhuman.com/u/Daniel_Stieber)\
**Post date:** [January 15, 2019, 9:22pm UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/2 "2019-01-15T21:22:10Z")

</div>

Hey @Scott_Weir

Here is an idea:

To calculate which day is in two weeks, you can do this:  
`Date(year(today()+14),month(today()+14),day(today()+14))`  
Now you can compare, if the IEP date is in two weeks and you can disable the “Email Feedback”-Button, if it is not:  
 ![11](https://global.discourse-cdn.com/coda1/original/2X/2/28808e18842fc9941ceefbe84bd48624cbf62ba5.png)

Now set up an automation that pushes the Email Feedback Button daily. It should only push the active buttons.

![25](https://global.discourse-cdn.com/coda1/original/2X/4/491dbf0ad0a1efea6bc39f140f76136816c06fa7.png)

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [January 16, 2019, 5:31am UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/3 "2019-01-16T05:31:04Z")

</div>

Hey @Daniel_Stieber,

Thank you for the help and for the idea! For some reason it is not working though. . . It is disabling all my buttons, even if I manually set the “IEP date” column to be exactly 14 days from now, that button is still disabled.

Any idea why?

---

<div class="post-metadata">

**Author:** ![Daniel\_Stieber](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/daniel_stieber/32/17045_2.png) [@Daniel\_Stieber](https://connect.superhuman.com/u/Daniel_Stieber)\
**Post date:** [January 16, 2019, 6:25am UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/4 "2019-01-16T06:25:00Z")

</div>

🤔 Can you make a screenshot of your „disabled if“ part?

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [January 16, 2019, 3:13pm UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/5 "2019-01-16T15:13:07Z")

</div>

> [@Daniel\_Stieber](#):
>
> Date(year(today()+14),month(today()+14),day(today()+14))

Hey @Daniel_Stieber,

Thanks again for the help. It actually is working better now, but there is a bug with the time that is included in my “IEP date” column. If the time is set to anything other than 12:00am, it disables it _even if_ the date is 14 days away as was specified in the “disable if” formula. Screen shot attached.

 ![CODA%20Screen%20Shot%202](https://global.discourse-cdn.com/coda1/original/2X/7/7aa236e3585c8d40c171a7fbc96d27aefbda8e9d.jpeg)

---

<div class="post-metadata">

**Author:** ![Daniel\_Stieber](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/daniel_stieber/32/17045_2.png) [@Daniel\_Stieber](https://connect.superhuman.com/u/Daniel_Stieber)\
**Post date:** [January 16, 2019, 3:27pm UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/6 "2019-01-16T15:27:26Z")

</div>

@Scott_Weir

ooh I see. There might be a smoother solution but a working hack:

`Date(year(today()+14),month(today()+14),day(today()+14)) != Date(Date.Year(),Date.Month(),Date.Day())`

That way you translate the datetime column in just a date and compare those two dates then.

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [January 16, 2019, 5:03pm UTC](https://connect.superhuman.com/t/automation-to-press-button-with-time-based-formula/5915/7 "2019-01-16T17:03:58Z")

</div>

> [@Daniel\_Stieber](#):
>
> Date(year(today()+14),month(today()+14),day(today()+14)) != Date(Date.Year(),Date.Month(),Date.Day())

It worked for me! Thanks!

I have another question in a new thread I just started @Daniel_Stieber if you can be of any help in that one as well. Also has to do with disabling a button.
