# Accessing Server Clock

**URL:** <https://forum.inductiveautomation.com/t/accessing-server-clock/3830>\
**Category:** Ignition\
**Created:** [January 6, 2012, 8:15pm UTC](https://forum.inductiveautomation.com/t/accessing-server-clock/3830 "2012-01-06T20:15:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davisr19](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@davisr19](https://forum.inductiveautomation.com/u/davisr19)\
**Post date:** [January 6, 2012, 8:15pm UTC](https://forum.inductiveautomation.com/t/accessing-server-clock/3830/1 "2012-01-06T20:15:09Z")

</div>

What is the best way to access the server’s clock time from an expression?

I am currently using the now() function but it gets its time from the client PC clock.

---

<div class="post-metadata">

**Author:** ![jsham](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jsham](https://forum.inductiveautomation.com/u/jsham)\
**Post date:** [January 6, 2012, 8:31pm UTC](https://forum.inductiveautomation.com/t/accessing-server-clock/3830/2 "2012-01-06T20:31:33Z")

</div>

We’ve used a SELECT CURRENT\_TIMESTAMP or SELECT getdate() query to grab gateway time, assuming SQL is running on the same machine. Even if its not, we usually have a central appliance or server running a NTP server that keeps all the servers in sync, so the SQL machine may not differ too much from the gateway server.

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [January 6, 2012, 9:57pm UTC](https://forum.inductiveautomation.com/t/accessing-server-clock/3830/3 "2012-01-06T21:57:35Z")

</div>

I suppose the gateway’s time would make a good status tag, which is easy enough for us to add. However, I think you should be able to do this by simply creating an expression SQLTag, whose expression was simply “now()”. Put it in a 1 second scan class, and then reference that in your other expressions, instead of a function. SQLTags run on the gateway, so the time will be from there.

Hope this helps,
