# Combining Current Time and Minutes Left

**URL:** <https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097>\
**Category:** Ignition\
**Created:** [May 8, 2024, 1:29pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097 "2024-05-08T13:29:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaleb.s](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kaleb.s](https://forum.inductiveautomation.com/u/kaleb.s)\
**Post date:** [May 8, 2024, 1:29pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/1 "2024-05-08T13:29:20Z")

</div>

Im trying to create a datetime tag that combines a current time tag and a float tag with "minutes left" together. I am basically trying to figure out a production end time based on a end goal and an average done per hour.

Right now i have a tag that displays currentTime and I have a tag that displays minutesLeft. In stupid terms I just need to add currentTime+minutesLeft and have it output in dateTime format.

I know there is system.date.addMinutes(X,X) however I need to use a tag value that is constantly changing for the second argument in addMinutes.

Any ideas?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 8, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/2 "2024-05-08T13:33:46Z")

</div>

There is a corresponding expression function you can use in an expression binding (or expression tag):

> **[add\* | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/date-and-time/add)**
>
> Add or subtract an amount to a given date and time

---

<div class="post-metadata">

**Author:** ![kaleb.s](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kaleb.s](https://forum.inductiveautomation.com/u/kaleb.s)\
**Post date:** [May 8, 2024, 1:35pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/3 "2024-05-08T13:35:14Z")

</div>

The Syntax is add\*(date, value)

For the Value argument how can I use a tag path in there?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 8, 2024, 1:36pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/4 "2024-05-08T13:36:38Z")

</div>

`addMinutes(now(5000), {[default]MinutesLeft})`

![Minutes left](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/a/6a3be6dd9fe3ba2e82de8be2bd44ea736a4a2bcd.png)

1. Pick the function.
2. Pick the tag.

`now(5000)` causes the expression to reevaluate every 5000 ms. Adjust to suit.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 8, 2024, 1:36pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/5 "2024-05-08T13:36:50Z")

</div>

Something like

```python
addMinutes({path/to/now}, {path/to/forecastMinutes})

```

---

<div class="post-metadata">

**Author:** ![kaleb.s](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kaleb.s](https://forum.inductiveautomation.com/u/kaleb.s)\
**Post date:** [May 8, 2024, 1:37pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/6 "2024-05-08T13:37:31Z")

</div>

Got it, appreciate the help guys.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 8, 2024, 1:38pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/7 "2024-05-08T13:38:35Z")

</div>

Good. Don't forget to mark one of the answers as "Solution".

---

<div class="post-metadata">

**Author:** ![kaleb.s](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kaleb.s](https://forum.inductiveautomation.com/u/kaleb.s)\
**Post date:** [May 8, 2024, 1:51pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/8 "2024-05-08T13:51:27Z")

</div>

How can I format the label to only show the time like I have the tag formatted? Its showing the date first then the time. I have the tag I want to display formatted with h:mm aa and thats also how I want the label on the page to show but i dont see any formatting options for it.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 8, 2024, 1:54pm UTC](https://forum.inductiveautomation.com/t/combining-current-time-and-minutes-left/90097/9 "2024-05-08T13:54:12Z")

</div>

```python
dateFormat(
	addMinutes(now(5000), {[default]MinutesLeft}),
	'h:mm aa'
)

```

If you had pressed (1) in my image above you should have been able to find it. See [Expression Functions | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions) for the docs.
