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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to read timezone in thingworx

MM_9023322
15-Moonstone

How to read timezone in thingworx

Hi all,

How to read the timezone in Thingworx?

 

Thank you!

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Velkumar
19-Tanzanite
(To:MM_9023322)

Hi @MM_9023322 

 

Since Thingworx is configured in the UTC timezone, you can convert PST to UTC and set the scheduler CRON string accordingly. For example: When PST is 00:00, UTC will be 07:00. So you can set the scheduler to trigger at 07:00 UTC for the facility in Sacramento.

 

Create a new scheduler for each facility and update the CRON string based on the facility timezone 

 

If scheduler configurations are updated from Mashup / Runtime, you can get the client browser timezone difference and convert it to UTC to update scheduler configurations.

 

/VR

 

 

 

 

View solution in original post

6 REPLIES 6
Velkumar
19-Tanzanite
(To:MM_9023322)

Hi @MM_9023322  

 

If you want to get the Thingworx server timezone you can get using the below method.

Velkumar_0-1696584951555.png

 

To get the client browser timezone 

timevalue = new Date();
Output = timevalue.toString();

Velkumar_2-1696586235399.png

 

To get the client browser timezone difference, you can use "getTimezoneOffset()" in the expression function to get the timezone offset value

 

timevalue = new Date();
Output = timevalue.getTimezoneOffset();

 

Velkumar_1-1696586137624.png

 

/VR

MM_9023322
15-Moonstone
(To:Velkumar)

Hi @Velkumar , no I don't want server time, I want to get the facility time. Say, if my input is CDT, PST, IST should give me time as per it!

Velkumar
19-Tanzanite
(To:MM_9023322)

Hi @MM_9023322 

 

Could you please explain your use case 

 

/VR

MM_9023322
15-Moonstone
(To:Velkumar)

Sure, I have a facility in Sacramento which is in PST. My server is in UTC. Now I want to trigger every day when the time is 00:00 in PST. My time is set to trigger every 30min, because like PST, I have facilities at CST, IST, UTC. So whenever the facilitytime is 00:00  service should run. My input should be CST/PST/.. and should give me facility time! How I can do it?

 

how about a separate treatment for time? I mean, creating a function to specialize in time.

Velkumar
19-Tanzanite
(To:MM_9023322)

Hi @MM_9023322 

 

Since Thingworx is configured in the UTC timezone, you can convert PST to UTC and set the scheduler CRON string accordingly. For example: When PST is 00:00, UTC will be 07:00. So you can set the scheduler to trigger at 07:00 UTC for the facility in Sacramento.

 

Create a new scheduler for each facility and update the CRON string based on the facility timezone 

 

If scheduler configurations are updated from Mashup / Runtime, you can get the client browser timezone difference and convert it to UTC to update scheduler configurations.

 

/VR

 

 

 

 

Announcements


Top Tags