# Creating an event that occurs 3 times a day

**URL:** <https://forum.inductiveautomation.com/t/creating-an-event-that-occurs-3-times-a-day/36254>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [July 1, 2020, 4:16pm UTC](https://forum.inductiveautomation.com/t/creating-an-event-that-occurs-3-times-a-day/36254 "2020-07-01T16:16:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpaugh](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@bpaugh](https://forum.inductiveautomation.com/u/bpaugh)\
**Post date:** [July 1, 2020, 4:16pm UTC](https://forum.inductiveautomation.com/t/creating-an-event-that-occurs-3-times-a-day/36254/1 "2020-07-01T16:16:07Z")

</div>

I am trying to create a log and need to have a id# increase by one every 9 hours. I have searched the web and forums, and have come up empty. I do not even know where to begin at this point. Any help pointing me in the right direction would be great. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [July 1, 2020, 4:24pm UTC](https://forum.inductiveautomation.com/t/creating-an-event-that-occurs-3-times-a-day/36254/2 "2020-07-01T16:24:31Z")

</div>

If you don't care what time it occurs, just every 9 hours a gateway event script can do this for you. Otherwise you can create a tag group with a 9 hour scan rate and use a tag event script. If you do want it on certain hours it is trickier, see this post. If you describe how your ID# works (is it an integer tag) we can post a script for you.

> [@Gateway Script Only at 4pm](http://forum.inductiveautomation.com/t/gateway-script-only-at-4pm/19979/7):
>
> From a 1 second timer script. [code]import system from time import localtime, strftime curTime = strftime("%H:%M:%S", localtime()) if curTime == ‘16:00:00’: #Time is military time, include leading zero in hour. system.tag.write(“tag”,value)[/code]

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [July 1, 2020, 6:01pm UTC](https://forum.inductiveautomation.com/t/creating-an-event-that-occurs-3-times-a-day/36254/3 "2020-07-01T18:01:23Z")

</div>

Actually it’s pretty easy. Create a new expression tag called “currentHour”

set the expression: getHour24(now(1000)) # Adjust the polling to your liking.

Add a value change script

```auto
if not initialValue and currentValue.value in [7,15, 21]:
    # initialValue evaluation may or may not be required?? I dunno
    do something

```

Some thought needs to be given to scope and what, if any, outside function you may need to call.
