# Constant.Today - 1 year ? How

**URL:** <https://www.epiusers.help/t/constant-today-1-year-how/119722>\
**Category:** Kinetic ERP\
**Created:** [October 9, 2024, 4:35pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722 "2024-10-09T16:35:30Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 9, 2024, 4:35pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/1 "2024-10-09T16:35:31Z")

</div>

Greetings all,

I need a little help translating this :  
DateTime.Now.AddYears(-1) ------ SQL  
or  
DATEADD(yy,-1,Constant.Today ------ BAQ Speak

to something that will work in App Studio here

 ![image](https://www.epiusers.help/uploads/default/original/3X/d/f/df2ecd774629b287b1dd27d257e1cb053ecc2121.png)

Is it JSON ( as the ‘Editor’ suggests) ? ( via the pencil icon)  
 ![image](https://www.epiusers.help/uploads/default/original/3X/0/8/08fc0d5ecbbfe160b5490efc226bd3b8fa214438.png)

or another Epicoreze syntax ?

I am using a Datepicker in a Dashhboard to provide parameters for a BAQ which in turn feeds a grid on said dashboard.

Thanks

Dean

---

<div class="post-metadata">

**Author:** ![dcamlin](https://www.epiusers.help/user_avatar/www.epiusers.help/dcamlin/32/57759_2.png) [@dcamlin](https://www.epiusers.help/u/dcamlin)\
**Post date:** [October 9, 2024, 6:10pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/2 "2024-10-09T18:10:20Z")

</div>

This will get you today’s date:

![image](https://www.epiusers.help/uploads/default/original/3X/7/f/7ff1fb97703e308f4934b272d8430305b796abc2.png)

Subtracting 1-year… **🤷‍♂️**

---

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 9, 2024, 6:15pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/3 "2024-10-09T18:15:45Z")

</div>

looks like 58 other people have the same question…

---

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 11, 2024, 3:28pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/4 "2024-10-11T15:28:07Z")

</div>

Please @hmwillett !!! For you it would be an easy answer ??

---

<div class="post-metadata">

**Author:** ![jgehling](https://www.epiusers.help/user_avatar/www.epiusers.help/jgehling/32/78990_2.png) [@jgehling](https://www.epiusers.help/u/jgehling)\
**Post date:** [October 11, 2024, 3:32pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/5 "2024-10-11T15:32:14Z")

</div>

This may sound silly, and I’m all for logic to be ran server-side, so could you make a simple function to do this calculation and return it back to the app? I know it seems like more effort for a trivial thing lol

---

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 11, 2024, 3:38pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/6 "2024-10-11T15:38:22Z")

</div>

True, especially for a default value on a form…/ dashboard…

---

<div class="post-metadata">

**Author:** ![jwphillips](https://www.epiusers.help/user_avatar/www.epiusers.help/jwphillips/32/89816_2.png) [@jwphillips](https://www.epiusers.help/u/jwphillips)\
**Post date:** [October 11, 2024, 4:09pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/7 "2024-10-11T16:09:38Z")

</div>

> [@jgehling](#):
>
> make a simple function to do this calculation

I made a similar function for a dashboard default date … and even though it’s yet another call to the server, it’s a super simple function, so it’s super fast. On our system the response is back before the dashboard BAQ is finished running.

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [October 11, 2024, 4:16pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/8 "2024-10-11T16:16:24Z")

</div>

> [@DeanMiller](#):
>
> Please @hmwillett !!! For you it would be an easy answer ??

`#_'(new Date(new Date().getFullYear() - 1, new Date().getMonth(), new Date().getDate())).toLocaleDateString()'_#`

JavaScript is gross. Do what @jwphillips said and make a function. I have a library called “HelperFuncs” for stuff like this. Little one-liners and whatnot.

---

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 11, 2024, 4:36pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/9 "2024-10-11T16:36:57Z")

</div>

Thank you so Much Hanna !!!  
Really appreciated, sorry I had to tag you.

Dean

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [October 11, 2024, 4:38pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/10 "2024-10-11T16:38:59Z")

</div>

> [@DeanMiller](#):
>
> sorry I had to tag you.

Say it 3 times next time. I wanna be the new Beetlejuice.

![Tim Burton Yes GIF by Freeform](https://media4.giphy.com/media/P1HmB7u6twPPZkE3Vw/giphy.webp?cid=e90edba3fne4dv9myp5bmufttb38e0hfuzf4dv5y2zw25lwl&ep=v1_gifs_search&rid=giphy.webp&ct=g)

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [October 11, 2024, 4:56pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/11 "2024-10-11T16:56:37Z")

</div>

> [@jwphillips](#):
>
> I made a similar function

An Epicor Function? Or something else?

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [October 11, 2024, 4:59pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/12 "2024-10-11T16:59:12Z")

</div>

Epicor

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [October 11, 2024, 5:32pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/13 "2024-10-11T17:32:36Z")

</div>

> [@hmwillett](#):
>
> #_‘(new Date(new Date().getFullYear() - 1, new Date().getMonth(), new Date().getDate())).toLocaleDateString()’_#

Me and David _almost_ had it lol.

---

<div class="post-metadata">

**Author:** ![dcamlin](https://www.epiusers.help/user_avatar/www.epiusers.help/dcamlin/32/57759_2.png) [@dcamlin](https://www.epiusers.help/u/dcamlin)\
**Post date:** [October 11, 2024, 6:29pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/14 "2024-10-11T18:29:58Z")

</div>

we tried anyway. close but no cigar.

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [October 11, 2024, 6:30pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/15 "2024-10-11T18:30:59Z")

</div>

> [@dcamlin](#):
>
> close but no cigar

we were _very_ close 🫂

---

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 11, 2024, 6:39pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/16 "2024-10-11T18:39:29Z")

</div>

Don’t get to excited, I have such confidence in Hanna that I marked it solved without even trying it…

![Thinking Think GIF by Rodney Dangerfield](https://media2.giphy.com/media/gEvab1ilmJjA82FaSV/giphy.webp?cid=e90edba3et2576xsezffss4n3i9pqfytey5rimacv6mrysdu&ep=v1_gifs_search&rid=giphy.webp&ct=g)

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [October 11, 2024, 6:40pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/17 "2024-10-11T18:40:52Z")

</div>

> [@DeanMiller](#):
>
> I have such confidence in Hanna

That’s how I got all my points.

Half my stuff don’t work, but people forget and never try stuff 🤣

---

<div class="post-metadata">

**Author:** ![DeanMiller](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@DeanMiller](https://www.epiusers.help/u/DeanMiller)\
**Post date:** [October 11, 2024, 6:42pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/18 "2024-10-11T18:42:58Z")

</div>

It being her formula of course

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [October 11, 2024, 6:55pm UTC](https://www.epiusers.help/t/constant-today-1-year-how/119722/19 "2024-10-11T18:55:12Z")

</div>

![Sliding Tom Cruise GIF by HULU](https://media0.giphy.com/media/3o6ZtjzbXB0XOAUOC4/giphy.webp?cid=e90edba3t80d5yib8mfifp6u0xna8116d1i00qm7pc5xxn1s&ep=v1_gifs_search&rid=giphy.webp&ct=g)
