# Setting Logic Variable by HomeyScript

**URL:** <https://community.homey.app/t/setting-logic-variable-by-homeyscript/14819>\
**Category:** Questions & Help\
**Created:** [June 25, 2019, 3:11pm UTC](https://community.homey.app/t/setting-logic-variable-by-homeyscript/14819 "2019-06-25T15:11:16Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [July 1, 2019, 9:43am UTC](https://community.homey.app/t/setting-logic-variable-by-homeyscript/14819/8 "2019-07-01T09:43:23Z")

</div>

@Satoer The good news is, you can make your own variables in HomeyScript and they also can be used in your Flows, here is my example:

```
// my12HoursClock
let sys = await Homey.system.getInfo();
var theTime = new Date(sys.date);
var theHour = theTime.getHours();
if (theHour > 12) { theHour = theHour - 12};
await setTagValue("klok12h", {type:"number", title: "Klok12H"}, theHour );
//console.log('TheHour',theHour);
return(true);

```

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/3/35471d1f8622a57a3dbbea635ec51fb189f35ac8.png)

---

_[View the full topic](https://community.homey.app/t/setting-logic-variable-by-homeyscript/14819)._
