Timezone on OH3 Clock Widget

Platform information:
Hardware: Raspberry Pi 3
OS: OpenHABian
openHAB version: 3.1.0

Hi, I have a friend who lives in a different country to me and I’m trying to make a clock widget with the Swiss timezone (UTC+01 & +02) However I cannot figure out how to do it, I’ve looked at the community here, Google, OpenHAB documentation, the dayjs date and time formatting options, and tried myself and haven’t found anything relevent to the problem. I can’t change the date on the Raspberry Pi because I have another clock widgit with British time. Attached at the bottom should be what I’m trying to do, the left side needs to be British time and the right needs to be Swiss time.

Ideally I want to take the current timezone on the Raspberry Pi and add one hour so It’ll change when the clocks change due to daylight savings automatically.

Thank you,

1 Like

I don’t believe the timezone extension for dayjs is enabled, but if you really just need the display to be one hour ahead then you should just be able to use the dayjs add method

=dayjs([time isostring]).add(1,"hour")

Sorry but I’m a complete beginner with this, would I just type in


Into the Time Format field?

Sorry for the terrible formatting, currently away from my computer so have to use my phone to type this.

Thank you

Sorry, I misinterpreted at first. I thought you were trying to make your own clock widget, not use the built-in system widget.

Unfortunately the system widget does not have the capability that you want. The system widget gets the time by using the dayjs() object which when called like that without any inputs simply returns the current system time. A dayjs object like that, if you have access to it is very powerful and allows all manner of easy manipulations to the time before you format it for output, however, in order to make the clock widget user-friendly and simple, no part of the dayjs object other than the format options are exposed to the user so there is simply no way to change the time.

Making your own clock widget, it would be very easy to use code such as I first proposed to get whatever changes to the time you wish. On the other hand getting it to refresh at 1 second or even 1 minute intervals would be very tricky (if not impossible, I’ve never tried).