MYSQL Time from Record different

Hello

I want to read data from my MYSQL Database and show the records in a Table.
That works fine but my problem is that the time is different. Its exactly 2 hours different.
Here some Pictures:


I think that node-red only reads the records from the database and shows them in the template. But where comes the time (Zeit) difference?

Can anyone please help me with this problem?

Possibly you are writing the date in UTC (as you should)
if you want to convert to local timezone, mysql provides some function to do that in the sql query
It could be something like :

SELECT ID, CONVERT_TZ(Zeit,'+00:00','+2:00') as Zeit, Ereignis WHERE ...

https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_convert-tz

Hello UnborN

Thanks for the fast reply.
The timestamp in the database is automatically generated by a new record.
The timestamp in the sql database is the correct one.
The database and Node red are Running on the same Server (QNAP NAS). So i don‘t unterstand why Node red changes the „value“ of the record.. by reading it.

i doubt that it is the node-red sql node that is changing it
i think its displaying it as it was saved .. in UTC

Have you changed the option in the mysql node to set the timezone ?

image

when I set the timezone to +2h is it correct.
but now I have to change the offset in march and October, hmm.

thanks for your support, I will see if i can set the time of the database node globally with summer and wintertime.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.