# Assigning Hour of Day to Tag

**URL:** <https://forum.inductiveautomation.com/t/assigning-hour-of-day-to-tag/28525>\
**Category:** Ignition\
**Created:** [September 24, 2019, 7:57pm UTC](https://forum.inductiveautomation.com/t/assigning-hour-of-day-to-tag/28525 "2019-09-24T19:57:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfeiten](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@gfeiten](https://forum.inductiveautomation.com/u/gfeiten)\
**Post date:** [September 24, 2019, 7:57pm UTC](https://forum.inductiveautomation.com/t/assigning-hour-of-day-to-tag/28525/1 "2019-09-24T19:57:19Z")

</div>

I’m trying to create a tag with the value equal to the hour of the day.

I tried creating an expression tag with the Expression:  
1 system.date.getHour24(system.date.now())

This function returns the correct value in the script console, but will not work as an Expression Tag, Expression.

Any other ideas?

---

<div class="post-metadata">

**Author:** ![ajdewhirst1](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@ajdewhirst1](https://forum.inductiveautomation.com/u/ajdewhirst1)\
**Post date:** [September 24, 2019, 8:01pm UTC](https://forum.inductiveautomation.com/t/assigning-hour-of-day-to-tag/28525/2 "2019-09-24T20:01:25Z")

</div>

Try the expression:  
dateExtract(now(), “hour”)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 24, 2019, 8:03pm UTC](https://forum.inductiveautomation.com/t/assigning-hour-of-day-to-tag/28525/3 "2019-09-24T20:03:18Z")

</div>

You can shorten it to:

```auto
getHour24(now())

```

The reason is that expression language is different than scripting language. 😉

EDIT: Sorry, had to modify it a bit further…
