Difference in Time Zone in UI Builder

I am using a UI Builder to show data from my SQL Server. The data is having difference in TIME ZONE i guess in UI Builder to that of SQL Server. My Payload data is also coming same time zone as of SQL Server but in UI it shows different.
Kindly Help.

Clearly you are in a timezone that is 5 1/2 hrs later than UTC. The web interface is showing UTC but it looks like you are storing local time in the db.

It is best practice to store UTC in a db since anything else leaves you open to the whims of DST and TZ changes.

Then show local times for user input/output for convenience.

This, of course, would be the same whether using uibuilder or not. I suspect that the node you are using to get data from the DB is converting SQL Server timestamps into JavaScript Dates, when you send a Javascript object as a msg to uibuilder (or Dashboard for that matter), because it has to go via websockets (more accurately Socket.IO) which does not support JavaScript objects directly, it has to be "serialised" (e.g. turned into text) and then turned back at the other end. Normally, you don't notice this happening. However, JavaScript Date objects are serialised to an ISO time string and can't be automatically changed back. That is what you are seeing in your UI.

So to show the data in a local format, you need to convert the timestamp columns in the table back to a local, human readable format. Check out the Intl tools for that.

Intl - JavaScript | MDN (mozilla.org)


Thanks a lot for the info. I would appreciate if you could help me out on where and how to convert the time stamp. I have tried the Intl Solutions mentioned but didn't get success. Here i am making and array of data in which Starttime & CloseTime is my key for UI builder JS file which is sending using HTTP request (Mainly Socket.IO).

sorry, cant do examples at the moment as i have a broken thumb in a cast. you should be able to find examples on the web.

replace you e. vars with calculated values using the intl library.

@TROJAN053 I would make a test. What happens if you replace:

Starttime : e.Start_Time


Starttime: new Date(e.Start_Time)


No change, Payload is still the same.

The results depend on the locale of your browser. You can try with the toLocaleDateString() method, which returns a string with a language-sensitive representation of the date portion of the specified date in the user agent's timezone.

Finally my problem resolves using MSSQL Node Plus, this actually supports UTC time format and finally there no change in time to IST in payload.