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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Convert the datetime from any timezone to UTC timezone

MM_9023322
14-Alexandrite

Convert the datetime from any timezone to UTC timezone

Hi all,

 

I am looking for a conversion from my system timezone say (IST) to UTC (00:00) timezone. I have used toUTCString function and then reverted back to YYYY-MM-DD hh:mm:ss format (DateTime as output) but it fails. So, what is an alternative to achieve this?

 

Thank you

3 REPLIES 3
jensc
17-Peridot
(To:MM_9023322)

Hello,

 

Where would you like this conversion to happen?

If you are thinking about backend then all dates are handled using UTC (unless you have changed the timezone in the platform configurations).

If you are thinking about frontend then thingworx also automatically converts from UTC to the browsers local time.

 

I'm not sure it is possible to use the datetime variable type for this, instead you might have more luck using a string (as it will not get converted).

 

Regards,

Jens

MM_9023322
14-Alexandrite
(To:jensc)

Hi Jens,

 

Thank you for the quick response, yes I am trying at the backend, I have a service where I am giving the DateTime, by default the time is set to 00:00, so when I set my system to UTC, on hover of the graph shows correct data i.e. 00:00 but when I change say IST then it shows 5:30 on hover, so I want to know if my input itself can be converted into UTC then my output will always show 00:00.

 

 

Thank you! 

jensc
17-Peridot
(To:MM_9023322)

Hello,

 

Thank you for your clarifications.

I found this support ticket: Link

Perhaps it can help you. There seem to be some information to prevent datetime conversions.

 

Regards,

Jens

Top Tags