Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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?
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.
Thanks & Regards,
Arun C
For me, output time is changing based on timezone offset. I dont want this to be happened.
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
After made changes based on offset time, still setHours are not working.
Hello,
From my tests, the .getTimeOffset() function returns zero as the platform is set to UTC.
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
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