# dateArithmetic

**URL:** <https://forum.inductiveautomation.com/t/datearithmetic/10209>\
**Category:** Ignition\
**Created:** [July 10, 2015, 5:12am UTC](https://forum.inductiveautomation.com/t/datearithmetic/10209 "2015-07-10T05:12:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven\_hargraves](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@steven\_hargraves](https://forum.inductiveautomation.com/u/steven_hargraves)\
**Post date:** [July 10, 2015, 5:12am UTC](https://forum.inductiveautomation.com/t/datearithmetic/10209/1 "2015-07-10T05:12:47Z")

</div>

Hello All  
When I use the dateArithmetic function I get the msg …  
‘dateArithmetic is not defined’  
Any help appreciated.  
Thx  
Steve Hargraves

---

<div class="post-metadata">

**Author:** ![Chris\_Taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_taylor/32/3315_2.png) [@Chris\_Taylor](https://forum.inductiveautomation.com/u/Chris_Taylor)\
**Post date:** [July 10, 2015, 8:41am UTC](https://forum.inductiveautomation.com/t/datearithmetic/10209/2 "2015-07-10T08:41:22Z")

</div>

Steven

If you are trying to use “dateArithmetic” in a script then it won’t work because its is an expression and only used in expression tag bindings.

If you want some date arithmetic in scripts then take a look here

[https://docs.python.org/2/library/datetime.html](https://docs.python.org/2/library/datetime.html)

and

[http://code.runnable.com/UqC3So\_UioYMAAJr/date-arithmetic-for-python-datetime-and-timedelta](http://code.runnable.com/UqC3So_UioYMAAJr/date-arithmetic-for-python-datetime-and-timedelta)

to get some ideas

---

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [July 10, 2015, 12:52pm UTC](https://forum.inductiveautomation.com/t/datearithmetic/10209/3 "2015-07-10T12:52:42Z")

</div>

I’ve found that the java date stuff is much easier to work with. Of course that’s just my opinion. Here’s a bit of code that would make two dates, now and 7 days from now:

```auto
from java.util import Calendar
now = Calendar.getInstance()
later = now.clone()
later.add(Calendar.DATE,7)
print now.getTime()
print later.getTime()
```

I think what I like about using java stuff is the documentation is much better than jython’s.

---

<div class="post-metadata">

**Author:** ![steven\_hargraves](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@steven\_hargraves](https://forum.inductiveautomation.com/u/steven_hargraves)\
**Post date:** [July 13, 2015, 4:31am UTC](https://forum.inductiveautomation.com/t/datearithmetic/10209/4 "2015-07-13T04:31:40Z")

</div>

Thank you for your prompt replies.  
Steve Hargraves
