# Trigger script/write to tag based on day and time

**URL:** <https://forum.inductiveautomation.com/t/trigger-script-write-to-tag-based-on-day-and-time/18595>\
**Category:** Ignition\
**Created:** [June 24, 2018, 3:29am UTC](https://forum.inductiveautomation.com/t/trigger-script-write-to-tag-based-on-day-and-time/18595 "2018-06-24T03:29:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hazem.abdulrab](https://avatars.discourse-cdn.com/v4/letter/h/a183cd/32.png) [@hazem.abdulrab](https://forum.inductiveautomation.com/u/hazem.abdulrab)\
**Post date:** [June 24, 2018, 3:29am UTC](https://forum.inductiveautomation.com/t/trigger-script-write-to-tag-based-on-day-and-time/18595/1 "2018-06-24T03:29:28Z")

</div>

Hello,

I’m trying to setup a script that will trigger at a specific day of the week and time.  
my current issue is when i setup a button to run the script when its pressed just for testing . I get the following output please look at the console image. I’m supposed to see a number from 1-7 . I don’t know alot about coding but the instruction says it should return an integer between 1-7

ive attached the images with the sample code and console output

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7b18cfe1dbe31bb11838731205e67c6d2b6a7f9c.JPG)

---

<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:** [June 24, 2018, 3:42am UTC](https://forum.inductiveautomation.com/t/trigger-script-write-to-tag-based-on-day-and-time/18595/2 "2018-06-24T03:42:23Z")

</div>

Missing parenthesis. And needs to be fed a date/time value. Like so:

```auto
print system.date.getDayOfWeek(system.date.now())

```

Consider going through the generic tutorials on [python.org](http://python.org).

---

<div class="post-metadata">

**Author:** ![hazem.abdulrab](https://avatars.discourse-cdn.com/v4/letter/h/a183cd/32.png) [@hazem.abdulrab](https://forum.inductiveautomation.com/u/hazem.abdulrab)\
**Post date:** [June 25, 2018, 3:43am UTC](https://forum.inductiveautomation.com/t/trigger-script-write-to-tag-based-on-day-and-time/18595/3 "2018-06-25T03:43:58Z")

</div>

I will and thank you very much
