Professional OPC
Development Tools

logos

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.160 seconds

      

 Recommend this on Google