Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I am trying to display timestamp in local time where the asset is located (local time = asset time). I try to do this by
1. storing the local time in UTC time (server time) on the server (no offset)
2. get the timezone offset using the user's IP (user is person viewing the mashup)
3. add the timezone offset to the startDate and endDate of the query
4. subtract the timestamp value by the timezone offset value to display the data in the grid in asset time
This works great except the part when there was a daylight savings adjustment in the past.
Please see image below:
All of these records were restored with 00:00:00 for time, but you can see that the time shifted by 1 hour when daylight savings started on March 8th, 2020 in the US. When I use the timezone offset in step #2, I am using the current offset, which is -7. When I apply this to the query, it is applying it to all records even though some records need offset of -8 due to daylight savings adjustment. I can't get and apply historical timezone offset values.
How can I fix this?????
Solved! Go to Solution.
I was able to resolve the issue based on the article below. Timezone offset should be dealt with when adding the data to streams, etc., not afterwards like I had in my original post.
https://www.ptc.com/en/support/article/CS240366
In addition, I think the server goes by US DST schedule. DST starts/ends on different dates/times around the world.
https://www.timeanddate.com/time/dst/2020.html
By the way, our server is PTC cloud hosted.
Maybe the server should not adjust to daylight savings.
I think our server is actually in UTC time. The thingworx applicaiton adjusts the time displayed based on the user's timezone (person viewing mashup). Depending on the date stored in the application, it will adjust the offset appropriate for that time. So from March 8th, 2020 to Novermber 5th, 2020, it uses offset of -7. It uses offset of -8 before March 8th, 2020 to November 3, 2019.
Hi Willie,
Do you know if this instance was upgraded in-place from 7.0 ?
If it s hosted by PTC Cloud ? can you send me in PM its URL (except if you have already opened a support case).
Thanks.
It was not upgraded from 7.0. I think we started on 8.2. We are on 8.5.3 now.
I will send you a PM.
I was able to resolve the issue based on the article below. Timezone offset should be dealt with when adding the data to streams, etc., not afterwards like I had in my original post.
https://www.ptc.com/en/support/article/CS240366
Hi @Willie.
I'm glad to hear that you resolved the issue, and thank you for sharing the solution. Please mark your previous post as the Accepted Solution for the benefit of others with the same issue.
Thank you for your participation in our community!
Regards.
--Sharon