Display UTC Time

Recommended Posts

I am able to display the time using a variable value component and using the expression FormatDateTime("%c",SysTime()) which displays the current system time but I would rather have the current UTC time displayed instead. Is it possible to do this considering the application would be used in different timezones? i.e. want it to display UTC time no matter where the program is opened around the world. Thank you.

Share this post

Link to post
Share on other sites

You would have to have the user specify their timezone offset and then apply that to the display using simple math.  So, if their offset is +8, you'd just adjust your time stamps by 8*3600. 

Technically you probably could retrieve the local timezone setting from the OS using either shellExecute() or better, use extern() to load in the windows DLL that handles time.  These, however, are a bit more complicated to achieve and would require some research into the workings of Windows.  For example, I found that you can do this to get the time zone from the command prompt:

systeminfo | findstr  /C:”Time Zone”

which you might then be able to pipe to a local file that you could then read into DAQFactory using the file. functions.  It would take a little experimentation but should be workable.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now