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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

How to use the current time to record attribute data

CZ_9645217
14-Alexandrite

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

1 ACCEPTED SOLUTION

Accepted Solutions
BABA-SHYAM
14-Alexandrite
(To:CZ_9645217)

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
BABA-SHYAM
14-Alexandrite
(To:CZ_9645217)

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

CZ_9645217
14-Alexandrite
(To:BABA-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.

Top Tags