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

how to hardcode time in datepicker widget where date can be selected by user

AP_10343008
13-Aquamarine

how to hardcode time in datepicker widget where date can be selected by user

While fetching selected date from datepicker widget, i want to hardcode time as 23:59:59.000.

For example if 23/03/2022 is selected in datepicker widget means, while storing data i want tostore as 23/03/2022 23:59:59.000 in datatable. It should work correctly in all timezones. how to do this?

6 REPLIES 6

Hi @AP_10343008 ,

 

Can you please try with the JS function of " setHours (23, 59, 59, 000) " when you are storing the data in your service.

It may help you.

Arun_C_2-1681961545400.png

 

 

Thanks & Regards,

Arun C

AP_10343008
13-Aquamarine
(To:Arun_C)

For me, output time is changing based on timezone offset. I dont want this to be happened.

AP_10343008_0-1681984565037.png

 

jensc
17-Peridot
(To:AP_10343008)

Hello @AP_10343008,

 

I believe Thingworx will always convert from UTC to your local time in the output of the composer.

There is however some ways to get around it looking at this support article.

 

So perhaps you can try to use some of the steps there to get your service to work properly.

 

Regards,

Jens

AP_10343008
13-Aquamarine
(To:jensc)

After made changes based on offset time, still setHours are not working. 

AP_10343008_0-1682565195238.png

 

jensc
17-Peridot
(To:AP_10343008)

Hello,

 

From my tests, the .getTimeOffset() function returns zero as the platform is set to UTC.

jensc_0-1682575941469.png

So no, that won't work.

 

There is a function you can use that was added I think in 9.1, but it is definitively there in 9.3. The only thing is you have to know what timezone you are in: 

let params = {
	timezoneName: YourTimeZone /*STRING */
};
let offset = Resources["TimezoneServices"].GetOffsetFromTimezone(params);

 

Hope this helps.

 

Regards,

Jens

slangley
23-Emerald II
(To:AP_10343008)

Hi @AP_10343008.

 

We tested the instructions in the article Jens previously provided and it appears to work as expected when you execute the javascript as an expression on the mashup.  

 

Can you confirm how you tested?

 

Regards.

 

--Sharon

Announcements


Top Tags