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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.