# Going Backwards on start time

**URL:** <https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652>\
**Category:** Ignition\
**Tags:** database, scripting\
**Created:** [September 13, 2018, 9:03am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652 "2018-09-13T09:03:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shihab.azkar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shihab.azkar](https://forum.inductiveautomation.com/u/shihab.azkar)\
**Post date:** [September 13, 2018, 9:03am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652/1 "2018-09-13T09:03:29Z")

</div>

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/inductiveautomation/original/2X/e/e83c03f61e13178baba7964a231bc84235680cb7.png)

Hey,  
This is how the start and end times of a Production property is currently calculated, where the 25200 is 7 hours in seconds. the current date is the midnight of the previous day with 7 hours added on for the start date and the end date is 24 hours added on to that. WHich means I am currently recording 24 hours of data for that property.

I wish to accumulate a month worth of data for that property that needs to be displayed on a report everyday. Is there anyway I can minus time as opposed to adding on time? I am happy with the End time of the property but want the start time to move backwards to the current date as opposed to the current forward movement. Gives me an error when i currently do it.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 13, 2018, 11:18am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652/2 "2018-09-13T11:18:40Z")

</div>

Usually answers will be better if you show your work. What have you tried for StartDate and EndDate, and what error are you getting?

---

<div class="post-metadata">

**Author:** ![shihab.azkar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shihab.azkar](https://forum.inductiveautomation.com/u/shihab.azkar)\
**Post date:** [September 14, 2018, 1:55am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652/3 "2018-09-14T01:55:26Z")

</div>

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/596055f4758c1ba76b38d9544acb344e230ee3f6.png)

This is how the start time is currently calculated.

---

<div class="post-metadata">

**Author:** ![shihab.azkar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shihab.azkar](https://forum.inductiveautomation.com/u/shihab.azkar)\
**Post date:** [September 14, 2018, 1:56am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652/4 "2018-09-14T01:56:02Z")

</div>

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/df19f8bbbb049bcedc513801dc9b403eb8ce298f.png)

When I try to Minus the same number to go backwards of the current date this is error I get.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 14, 2018, 9:25am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652/5 "2018-09-14T09:25:42Z")

</div>

You should really use the [dateArithmetic](https://docs.inductiveautomation.com/display/DOC79/dateArithmetic) function.

```auto
dateArithmetic({Root Container.Schedule Date Selector.currentDate}, -7, "hour")

```

Or,

```auto
dateArithmetic({Root Container.Schedule Date Selector.currentDate}, -25200, "sec")

```

---

<div class="post-metadata">

**Author:** ![shihab.azkar](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shihab.azkar](https://forum.inductiveautomation.com/u/shihab.azkar)\
**Post date:** [September 17, 2018, 1:54am UTC](https://forum.inductiveautomation.com/t/going-backwards-on-start-time/19652/6 "2018-09-17T01:54:56Z")

</div>

Hey Jordan!

IT WORKED!!! This has been sooo helpful! I ve been stuck on it for months!

Cant thank you enough !
