# Create Global Event based on Time of Day

**URL:** <https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975>\
**Category:** Ignition\
**Created:** [November 13, 2017, 6:23am UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975 "2017-11-13T06:23:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter1](https://avatars.discourse-cdn.com/v4/letter/p/a587f6/32.png) [@peter1](https://forum.inductiveautomation.com/u/peter1)\
**Post date:** [November 13, 2017, 6:23am UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975/1 "2017-11-13T06:23:28Z")

</div>

How do I go about creating an event to run a project script based on time of day?  
I want to run a project script every day at 7am.

---

<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:** [November 13, 2017, 1:36pm UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975/2 "2017-11-13T13:36:16Z")

</div>

It depends on how precise you need it to be. I would recommend using a datetime memory tag holding your next deadline, and a fast-running timer event script that checks when the current time passes the deadline. At that point, compute and store back the next deadline and spawn the actual task as a background thread.

---

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [February 15, 2022, 8:35pm UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975/3 "2022-02-15T20:35:34Z")

</div>

I have a similar scenario, I need a Gateway script to run at a certain time of the day.

An alternative way of doing this might be something like . . .

I have a Gateway Timer Script that runs once a minute or each 60,000 ms. The script simply gets the hour and minutes, checks the time, and runs the rest of the script if it’s a specific time.

```auto
import datetime

hour = int(datetime.datetime.now().strftime("%H"))
minute = int(datetime.datetime.now().strftime("%M"))
second = int(datetime.datetime.now().strftime("%S"))

if hour == 7 and minute == 0: # if its 7:00 AM, run the code below 
	Debug.LogMessage('Iscariot', system.tag.readBlocking(["[default]G01/G01/Station Data/ST1/ST 1 Total Bad Parts"])[0].value , str(hour) + " : " + str(minute) + " : " + str(second))

```

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 15, 2022, 8:43pm UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975/4 "2022-02-15T20:43:51Z")

</div>

If you’re running current versions of Ignition 8 (not sure where exactly this was added, but it’s in 8.1.9), you have this option:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/7/f7c507a875fb7f543eedef8f67a584f4fb588fee.png)

---

<div class="post-metadata">

**Author:** ![rvaught](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rvaught](https://forum.inductiveautomation.com/u/rvaught)\
**Post date:** [February 15, 2022, 8:45pm UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975/5 "2022-02-15T20:45:54Z")

</div>

That’s nice! I’m using 8.1.1. I Don’t have the `Scheduler` features

---

<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:** [February 15, 2022, 9:15pm UTC](https://forum.inductiveautomation.com/t/create-global-event-based-on-time-of-day/15975/6 "2022-02-15T21:15:02Z")

</div>

Scheduled scripts were added in 8.1.6. I’d suggest upgrading (for a variety of reasons) at your earliest convenience.

[https://docs.inductiveautomation.com/display/DOC81/Gateway+Event+Scripts#GatewayEventScripts-GatewayScheduledScripts](https://docs.inductiveautomation.com/display/DOC81/Gateway+Event+Scripts#GatewayEventScripts-GatewayScheduledScripts)
