# Date/Time Tag from Scheduled Gateway Event

**URL:** <https://forum.inductiveautomation.com/t/date-time-tag-from-scheduled-gateway-event/78239>\
**Category:** Ignition\
**Created:** [August 22, 2023, 3:15pm UTC](https://forum.inductiveautomation.com/t/date-time-tag-from-scheduled-gateway-event/78239 "2023-08-22T15:15:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Esters1](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@Tyler\_Esters1](https://forum.inductiveautomation.com/u/Tyler_Esters1)\
**Post date:** [August 22, 2023, 3:15pm UTC](https://forum.inductiveautomation.com/t/date-time-tag-from-scheduled-gateway-event/78239/1 "2023-08-22T15:15:49Z")

</div>

Hello,

I am trying to create a script that writes the date/time to a tag at that scheduled event. Here's what I have but I keep getting "TypeError: expected a str".  
I have tried the destination tagpath as both Date/time and String.

> def onScheduledEvent():  
> rightNow = system.date.now()  
> nowTag = system.tag.readBlocking(['[default]plant/shift/shiftStartTime)'])  
> system.tag.writeBlocking(nowTag,rightNow)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 22, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/date-time-tag-from-scheduled-gateway-event/78239/2 "2023-08-22T15:19:33Z")

</div>

You don't need to read the tag to write to it

```auto
system.tag.writeBlocking(['[default]plant/shift/shiftStartTime)'],[rightNow])

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 22, 2023, 3:24pm UTC](https://forum.inductiveautomation.com/t/date-time-tag-from-scheduled-gateway-event/78239/3 "2023-08-22T15:24:39Z")

</div>

`system.tag.readBlocking()` returns a list of `QualifiedValues`.

`system.tag.writeBlocking()` takes a list of tagPaths, and a List of values. As @dkhayes117 has shown.

To get the value read from a tag you need to get it from the list, and then refernece the `value` property of the `QualifiedValue`.

```auto
system.tag.readBlocking(['[default]plant/shift/shiftStartTime'])[0].value

```

[https://docs.inductiveautomation.com/display/DOC81/Scripting+Object+Reference#ScriptingObjectReference-QualifiedValue](https://docs.inductiveautomation.com/display/DOC81/Scripting+Object+Reference#ScriptingObjectReference-QualifiedValue)

For what you're showing here, you don't actually need to read the tag though.

Unless there is some other logic you are wanting to perform.
