Display local time from UTC time in label component in perspective

Hi,
I'm quering the UTC time from a named query and showing it on label component.

I have this binding on the label coponent but, it does not convert it into the local time.
Am I doing something wrong?

Rather than a format transform, have you tried using an expression transform with the getTimezoneOffset() expression?

You would need to turn the {value} into a date first though. I think you could use fromMillis()?

1 Like

This seems to work. This adds 30 mins more than actual time.
Is this the best way of doing this?

Okay, I understand why there is a 30 min offset. getTimezoneOffset() return value 5.5 in this case and addHours() rounds it up to 6.

But I can't figure out the right way to do this.

Why? Why not use an expression binding of now()?

My goal is to find the best method to display a timestamp from DB in local timezone in label component. Not really to display the current time.
This was just an example that I tried to use to show the situation.

Change your expression to addMinutes({value}, getTimezoneOffset({value}) * 60)

1 Like

But why? Are you trying to check the DB server clock is correct? It seems strange.