how to hardcode time in datepicker widget where date can be selected by user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Labels:
-
Mashup-Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
For me, output time is changing based on timezone offset. I dont want this to be happened.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
After made changes based on offset time, still setHours are not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
