Node Red time setting

I have one hour difference between local time and the one I get Time1

I have set timezone to Europe/Oslo
I have also added line

process.env.TZ = "Europe/Oslo";
into settings.js file

I see that RaspberryPi shows correct time. I use node-red to receive message from mqtt server. Message only contains temp and humidity values, no time in message payload. I then show temp and humidity with time on a dashboard and can see that time is always by 1 hour different.

This could also be driven by the function I use to get time:

msg.payload=new Date().toISOString()
return msg;

Is there any way to make it output correct time?

That is the correct time, the Z means that it is the time in UTC. If you lookup the JavaScript date functions you will find methods that will give you a string to display it in the local timezone.

thank you for advice!

have redone code based to following :

var d = new Date();
msg.payload=d
return msg;

And then added debug node and text box on dashboard where msg.payload is used for both.
gauge
Debug window shows data as I want it to be:

12/22/2019, 4:51:03 PMnode: c9fd5127.9a9ddIG_back_DHT22 : msg.payload : Date

"Sun Dec 22 2019 16:51:04 GMT+0100 (CET)"

However dashboard still shows value with Z at the end and with one hour diff.
dashboard
How this can be when same msg.payload is used for both. How can I get correct time on my dashboard?

As I said before those are both correct.15:51 UTC is the same time as 16:51 GMT+1. What you are asking is how to display that time in one format rather than the other.
One way to do that would be to feed it into a node-red-contrib-moment node to generate the particular format you want.

Take a look at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString too, it might do what you’re looking for.