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

Set Mashup Timezone

Ascherer17
14-Alexandrite

Set Mashup Timezone

Is it possible to set a timezone for a mashup so the datetime values show the context of the specified timezone?

I'm using the CreatePDF extension to create a PDF of a Time Series Chart.  Since the CreatePDF essentially logs itself into the server in the background then takes a snapshot, I have my mashup set to query data based on timestamps saved to a Thing.  My problem is that the dates shown in the PDF chart are hours ahead of the datetime values that I'm saving and feeding into the service.  I believe it is showing the UTC time. 

Could Localization Tables help with this?  Just trying to find a way to do this without having to manipulate the timestamps of the query data.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

 

Short answer, no way with Standard ThingWorx, ThingWorx Mashup runtime works on browser user TimeZone, no way to change it. If you are at server side (CreatePDF), you will be executing it all on Server Side TimeZone.

 

You can't rule TimeZone with ThingWorx, to do that you will need custom extensions on server side and custom Widgets at Browser side that has TimeZone as a property.

 

And doing offset operations by yourself it's never an option, TimeZone handling it's not just an offset operation ( you have daylight savings, political decisions that change TimeZone rules,...), there's plenty of libraries that deal with it on a correct way, actually the server side library that ThingWorx uses in java actually it supports setting the TimeZone (but they didn't publish this functionality).

 

I'm following this matter for more than three years with ThingWorx, but no way that they handle TimeZones correctly, we actually customized all Standard ThingWorx widgets in order to support correctly TimeZones.

 

Regards,

Carles Coll

View solution in original post

3 REPLIES 3

I believe the localization table only deals with the language, and all the automatically added timestamp are recorded in UTC not in local time.

 

You can add a property that gets local time for a more accurate local report, and you can use the difference between local time and UTC time to calculate the Time Zone.   On the other way, you can preload the timezone, and change the UTC time to User's local time.

 

1 hour gap in DateTime1 - DateTime2 = 3600000  (This can be done in Expression widget, whose input and output are set to DateTime property)

Hello,

 

Short answer, no way with Standard ThingWorx, ThingWorx Mashup runtime works on browser user TimeZone, no way to change it. If you are at server side (CreatePDF), you will be executing it all on Server Side TimeZone.

 

You can't rule TimeZone with ThingWorx, to do that you will need custom extensions on server side and custom Widgets at Browser side that has TimeZone as a property.

 

And doing offset operations by yourself it's never an option, TimeZone handling it's not just an offset operation ( you have daylight savings, political decisions that change TimeZone rules,...), there's plenty of libraries that deal with it on a correct way, actually the server side library that ThingWorx uses in java actually it supports setting the TimeZone (but they didn't publish this functionality).

 

I'm following this matter for more than three years with ThingWorx, but no way that they handle TimeZones correctly, we actually customized all Standard ThingWorx widgets in order to support correctly TimeZones.

 

Regards,

Carles Coll

Ascherer17
14-Alexandrite
(To:CarlesColl)

It seems like the CreatePDF doesn't necessarily run with the server time because that would give me the same results as if I ran the queries myself since the server is in the same timezone.  

 

I ended up using the TimeShift() function from the Resource "InfoTable Functions."  It's listed in the Snippets section when writing a custom service.  I used TimeShift with the timezone offset from UTC to get the desired timestamps when using CreatePDF.

Top Tags