Timestamps in databases should always be in UTC. This avoids a great many errors and date/time related problems. They should only be converted from/to local date/times at point of interaction with a person.
Thanks for the advice, but what I just want is display whatever data inside my table to dashboard, but the issue now is why it converts the data back into UTC for nodered. I need some reference for the sql query where I can keep the original data from sql to nodered
Not a good idea, better to stay with UTC and reformat to a valid SQL date/time stamp. Then there can be no confusion. But, of course, your choice.
Ok I see now. If I let it stay in UTC format, how I reformat it to valid SQL datetime?
And then, if I pass normal select query to display on dashboard, will it convert to UTC format again? If yes, no point of doing that bcs my goal is to display user the local time format.
OK, so you are actually getting ISO8602 strings from whatever node you are using to do the query. Slightly different to what I said but quite possibly the same issue but is either what your DB engine is returning or is what the custom node is returning.
Short of other choices, you should use your DB engine's SQL engine to format the returned dates as mentioned by smanjunath211 above.
You've not mentioned which SQL DB or node you are using. Not that I could be more specific myself because I very rarely use SQL these days. But others may well be able to help further.