Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

How to write current time not UTC time to OPC UA tag?

More
01 Oct 2018 18:43 #6727 by support
Standard OPC UA data type for time data is UtcTime. It is always in UTC, and has not time zone information it.

Assuming that the variable you are writing is of this data type, there is no way you could store the time zone information into it. If you want to properly write your current time to it, you should use DateTime.UtcNow.

Best regards

Please Log in or Create an account to join the conversation.

More
01 Oct 2018 18:18 #6726 by khanhqhoang
I would like to write current timezone (Pacific) to OPC UA tag defined as below.

ns=2;s=FBJ.Section.AFT.AFT-Timestamp

I use the code below to write to the Timestamp node. However, When I used either DateTime.Now or DateTime.UtcNow, it always wrote UTC time not the current time zone value. Please advise. Thanks

easyUAClient.WriteMultipleValues(new[]
{
new UAWriteValueArguments(strOPCServer,
strAddress + "Timestamp", DateTime.Now)


});

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.237 seconds