# Capture current date and time into a memory tag

**URL:** <https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936>\
**Category:** Ignition\
**Created:** [August 28, 2026, 1:32pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936 "2026-08-28T13:32:51Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![dfox37](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dfox37](https://forum.inductiveautomation.com/u/dfox37)\
**Post date:** [August 29, 2026, 7:44pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/21 "2026-08-29T19:44:55Z")

</div>

Yup went through the academy twice. However when I'm up against bugs in the software and video tutorials using older versions, it tends to get a bit frustrating. But the meta visibility works to hide the date when the cycle isn't running and I got the date to at least trigger off a plc tag so that's as good as it's going to get for now. I feel vision is a much better front end for a more typical scada as it was much more straight forward to do typical automation. But since the sales guy only wants to sell me perspective and for our testing purposes to we had to go with perspective, we'll make due.

---

<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:** [August 29, 2026, 8:26pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/22 "2026-08-29T20:26:19Z")

</div>

> [@pturmel](#):
>
> recommended approach

This applies to both Perspective and Vision. Gateway events and tags are isolated from user interfaces of either kind.

> [@dfox37](#):
>
> feel vision is a much better front end

This topic only leaned into Perspective after many comments--it isn't tagged for either and the OP isn't specific to either. Throwing stones at the different UIs can be fun, but has been beat to death in other topics. Consider participating in one of those...

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 31, 2026, 4:41am UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/23 "2026-08-31T04:41:39Z")

</div>

Regarding the visibility saga, there are differences between the different containers. For the most common:

- Flex containers: you can use either `position.display` or `meta.visible`.
  - `position.display` will remove the item from the DOM entirely, and effectively collapse the space the component took up -- _you would use this 99.9% of the time_
  - `meta.visible` will keep the component in the DOM and effectively make the component transparent; it will _not_ collapse the space the component takes up -- _useful in very limited circumstances_

- Coordinate containers: you can only use `meta.visible`

* * *

Regarding Perspective vs Vision, Perspective is _far_ better at creating standardised projects, however it's definitely a steep learning curve when you're used to traditional raster platforms like Vision. The biggest piece of advice for Perspective is to get familiar with CSS as it will help you immensely. That, and knowing that all scripts run on the gateway, not the client, so they have no access to local client resources.

_Note: DOM refers to the Document Object Model; think of it as all of the components that make up the HTML page which includes your labels, embedded views, containers, etc. which map into various HTML elements in the DOM_

* * *

And lastly, regarding the tag change script.. I would be adding this into the trigger tag's value change script, not into a gateway tag change script.

> **Waffle**
>
> In general, it's best to keep scripts that run inside _tag_ change events to execute very quickly, ~10ms or less, since these scripts run in a limited number of threads (3 by default) for the entire tag system, with up to 5 queued events per tag. If there are many tags configured with tag change events that hold up execution, it's possible for the tag event queues to fill up and then drop future events until the current ones are processed. In practice, it really depends how many tags you have that have tag events configured, and that 10ms figure is more or less a best practice guide to allow for substantial project scaling.

Into the trigger tag's value change event, I would add below. Note the use of writeAsync instead of writeBlocking so the tag event script isn't blocked while the tag writes, to ensure it runs quickly

```python
# Catch rising edge of transition from false to true, and when there is no previousValue
if currentValue.value and (not previousValue or not previousValue.value):
    system.tag.writeAsync(['Path/To/Storage/Tag'], [system.date.now()])

```

_Note: `previousValue` is `None` when there is no previous value, so `previousValue.value` produces an exception in this case which these conditions handle, since Python short circuits conditions_

---

<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:** [August 31, 2026, 12:22pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/24 "2026-08-31T12:22:30Z")

</div>

This may be a potayto, potahto thing, but why wouldn't we use `currentValue.timestamp`?

---

<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:** [August 31, 2026, 12:47pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/25 "2026-08-31T12:47:15Z")

</div>

> [@JordanCClark](#):
>
> why wouldn't we use `currentValue.timestamp`?

- Won't filter out true ⇒ false transitions, and
- Would be OPC server's timestamp, not gateway timestamp, for other than built-in drivers.

> [@nminchin](#):
>
> Note the use of writeAsync instead of writeBlocking so the tag event script isn't blocked while the tag writes, to ensure it runs quickly

Not required for writes to memory tags. (They are the only writes that don't actually block.)

---

<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:** [August 31, 2026, 12:55pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/26 "2026-08-31T12:55:32Z")

</div>

> [@pturmel](#):
>
> - Won't filter out true ⇒ false transitions

I was rather just meaning instead of system.date.now(). 😉

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 31, 2026, 2:13pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/27 "2026-08-31T14:13:38Z")

</div>

> [@pturmel](#):
>
> Not required for writes to memory tags

Oh, I missed it was into a mem tag (datetime type is pretty obviously a mem tag though...) , good practice to get into regardless however, if the result is dropped anyway 🤷

---

<div class="post-metadata">

**Author:** ![anthonymelio296](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/anthonymelio296/32/87056_2.png) [@anthonymelio296](https://forum.inductiveautomation.com/u/anthonymelio296)\
**Post date:** [September 1, 2026, 9:17am UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/28 "2026-09-01T09:17:09Z")

</div>

Yes. You don't need an `IF` just to copy the current time. If you want to capture the time when a PLC bit turns ON, simply do:

IF Trigger\_Bit THEN  
Time\_Stamp := NOW();  
END\_IF;

Make sure `Time_Stamp` is a **DATE\_AND\_TIME/DT** type supported by your PLC. If `NOW()` isn't accepted directly, check the tag's data type first.

I've used a similar approach in **IOTMATRIX's energy monitoring setup** , where timestamps are stored with machine and energy data to track exactly when an event or change occurred.

---

<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:** [September 1, 2026, 10:27am UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/29 "2026-09-01T10:27:15Z")

</div>

> [@anthonymelio296](#):
>
> You don't need

You seem confused about the environment discussed here. The topic is not about PLC code, but code in Ignition SCADA.

Of course, you might be an LLM-driven bot planning to post a marketing link shortly, since your final paragraph is spammy, and totally disconnected from the topic.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 1, 2026, 3:21pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/30 "2026-09-01T15:21:55Z")

</div>

> [@pturmel](#):
>
> you might be an LLM-driven bot planning to post a marketing link shortly

![Atg Stucapa](https://static.klipy.com/ii/4493325008d34b7bf8cd6813cd5c1619/c8/18/GBBHC6LG6gbRsrV.webp)  
I'm waiting patiently

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 1, 2026, 4:07pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/31 "2026-09-01T16:07:47Z")

</div>

We seem to have gotten quite off-topic. This is pretty trivial (or should be, for someone who apparently went through IA University _twice_).

1. Open the designer
2. Add a PLC tag to your provider
3. Add a memory tag to your provider to hold the date
4. Open `Project>Gateway Events`
5. Select `Tag Change`
6. Click the `+` to add a tag change event (give it a name)
7. Add the tag path to your tag from step 2 using the tag selector dialog
8. Add the script to write to the memory tag

```python
# Catch rising edge of transition from false to true
if not previousValue.value and newValue.value:
    system.tag.writeBlocking(['Path/To/Storage/Tag'], [system.date.now()])

```

---

<div class="post-metadata">

**Author:** ![dfox37](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dfox37](https://forum.inductiveautomation.com/u/dfox37)\
**Post date:** [September 2, 2026, 5:35pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/32 "2026-09-02T17:35:31Z")

</div>

I just wrote a simple script on the tag itself within my project using a combination of everything from everyone above. No gateway script needed. Wish things like this were simpler and spelled out better but it is what it is. Is there a way to mark this as closed? Interesting at the amount of spam coming from the leaders on here. Makes the little guys like me not want to contribute or ask questions. Maybe I'll keep my questions to chat gpt?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 2, 2026, 5:59pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/33 "2026-09-02T17:59:52Z")

</div>

Yes, a tag change script on a PLC tag would work as well.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 2, 2026, 8:50pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/34 "2026-09-02T20:50:37Z")

</div>

> [@dfox37](#):
>
> Interesting at the amount of spam coming from the leaders on here.

Interesting to note after spending considerable of my own time to put together at least one significantly longer (than normal) reply here, presumably with useful info in it. Its sad that one fun post would taint the rest

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 2, 2026, 10:45pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/35 "2026-09-02T22:45:55Z")

</div>

Let's just say this thread has run it's course. @dfox37 I'd encourage you to post any future questions you have in new threads; we really do like to help.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 2, 2026, 10:46pm UTC](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936/36 "2026-09-02T22:46:01Z")

</div>

Closed on September 2, 2026, 10:46pm UTC



[Previous page](https://forum.inductiveautomation.com/t/capture-current-date-and-time-into-a-memory-tag/116936.md?page=1)
