# Tag for Current Time in UTC?

**URL:** <https://forum.inductiveautomation.com/t/tag-for-current-time-in-utc/19221>\
**Category:** Ignition\
**Created:** [August 13, 2018, 2:11pm UTC](https://forum.inductiveautomation.com/t/tag-for-current-time-in-utc/19221 "2018-08-13T14:11:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhunter](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jhunter](https://forum.inductiveautomation.com/u/jhunter)\
**Post date:** [August 13, 2018, 2:11pm UTC](https://forum.inductiveautomation.com/t/tag-for-current-time-in-utc/19221/1 "2018-08-13T14:11:20Z")

</div>

Hello All,

First off, we are using Ignition version 7.7.4. I am trying to extract the different parts of a date for transmission into a database. Using the ‘dateExtract’ command, I was previously pulling the current time in with the ‘now’ tag, and getting the data I needed. The requirements have changed, so now I need to have this date/time info in UTC, instead of the gateway timezone (currently CST). There are other tags in the project that require the current gateway time, so I can’t change the ‘timezone behavior’ for the ‘now’ tag. Is there a system tag that has this info? Or is there an easy way to script a memory tag to convert the ‘now’ tag to UTC?

Here is an example as to how we are going to use this info:  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/89471615f852d3bf8a0044cfe0aeec56fc87a3db.png)

Thanks for the help in advance!

Jake

---

<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:** [August 13, 2018, 3:33pm UTC](https://forum.inductiveautomation.com/t/tag-for-current-time-in-utc/19221/2 "2018-08-13T15:33:52Z")

</div>

Could you use a database function like `GETDATE` or `CURRENT_TIMESTAMP` in another query tag?

We added a lot of date/time manipulation functions in 7.9 that make this a lot easier to do inside Ignition - but on 7.7, I think the database is your best option.

---

<div class="post-metadata">

**Author:** ![jhunter](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jhunter](https://forum.inductiveautomation.com/u/jhunter)\
**Post date:** [September 5, 2018, 1:29pm UTC](https://forum.inductiveautomation.com/t/tag-for-current-time-in-utc/19221/3 "2018-09-05T13:29:16Z")

</div>

Thank you for your reply, I ended up utilizing SQL to insert a UTC time stamp into the table when the data got processed.

---

<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:** [September 5, 2018, 2:11pm UTC](https://forum.inductiveautomation.com/t/tag-for-current-time-in-utc/19221/4 "2018-09-05T14:11:25Z")

</div>

It’s worth noting that java.util.Date objects are internally UTC and convert to the timezone of the program scope every time they are formatted into a string. And converted from the local timezone when constructed from hour/minute/second. These objects have a [toGMTString()](https://docs.oracle.com/javase/7/docs/api/java/util/Date.html#toGMTString()) method that ignores the scope’s timezone. The .time property of these objects are always millisecond-resolution unix UTC long integers. Sending them in an RPC payload from client to gateway sends the UTC value, and will be correct even if client and gateway have different timezones. JDBC calls convert automatiically where possible (suitable column types). For example, using `timestamp with timezone` in PostgreSQL results in a column that always stores UTC (converting to/from the DB client connection TZ).  
Run some experiments with a “SELECT CURRENT\_TIMESTAMP;” queries with varying client and gateway timezones.
