cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to use the current time to record attribute data

CZ_9645217
15-Moonstone

How to use the current time to record attribute data

Dear Community,

 

Now we have dozens of devices and thingworx collects process data to influxdb through kepware, but we found that the time of all these devices OPC UA is not correct, so the time recorded to the database is not correct, if we go to reset one by one, it will waste a lot of time, so if there is any setting to use thingworx server's current time to record to the database? That is, when kepware data changes, I record the changed value, but the time uses the current time of the system. I think it can be solved by Subscription, but there are very many devices and properties, and it's a waste of time to change them, do you have any good solution? thanks.

 

Best Regards,

Chason

ACCEPTED SOLUTION

Accepted Solutions

If you try to save current time, create a extra column and put value inside it. If you using services so you can use new Date(); Or in DB itself you can create a new column and make a default value as getDate() so that everytime a new record gets inserted you get time of insertion.
Another approach if your server is in different timezone then you need a offset time like for India offset is +5.5 (which is nothing but no of hours ahead of GMT)

 

Regards

Shyam

View solution in original post

2 REPLIES 2

If you try to save current time, create a extra column and put value inside it. If you using services so you can use new Date(); Or in DB itself you can create a new column and make a default value as getDate() so that everytime a new record gets inserted you get time of insertion.
Another approach if your server is in different timezone then you need a offset time like for India offset is +5.5 (which is nothing but no of hours ahead of GMT)

 

Regards

Shyam

Thank you very much for your quick reply, I think DB itself create a new column and make a default value as getDate() maybe more better for me, it will save me a lot of time.

Announcements


Top Tags