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

How to handle daylight savings and timezone offset values

SOLVED
Highlighted
Alexandrite

How to handle daylight savings and timezone offset values

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?????

 

Thingworx - 2020-10-02 - Timezone offset issue.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to handle daylight savings and timezone offset values

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

 

 

View solution in original post

7 REPLIES 7
Highlighted

Re: How to handle daylight savings and timezone offset values

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. 

Highlighted

Re: How to handle daylight savings and timezone offset values

Hi @Willie.

 

We recommend running ThingWorx in UTC to avoid time change issues.  Here's a link from the 9.0 Help Center regarding timezones.

 

Since your site is hosted, I recommend opening a case for the Cloud team.  I will be happy to open the case on your behalf, if you would like.

 

Regards.

 

--Sharon

Highlighted

Re: How to handle daylight savings and timezone offset values

@slangley 

 

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.  

Highlighted

Re: How to handle daylight savings and timezone offset values

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.

Highlighted

Re: How to handle daylight savings and timezone offset values

@smainente 

 

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.

 

Highlighted

Re: How to handle daylight savings and timezone offset values

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

 

 

View solution in original post

Highlighted

Re: How to handle daylight savings and timezone offset values

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

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!