How to display time according to a different time zone without sudo?

Assume a remote computer is located at time zone A, which is different from the time zone B of my location. But I wanna display time in the title of GNOME desktop according to the time zone B. For example, in the screenshot below, the displayed time is 5pm, but it is 11am in my location.

Without sudo privilege, how can I do it?

You can use the TZ environment variable to change the timezone used by most if not all applications (including gnome-shell).

1 Like

If I use Posix TZ Format, it works on command line. But the title of GNOME does not change.
image
image
So how to update GNOME as well?

You need to set the environment variable for the gnome-shell process, i.e. when launching gnome-shell.

1 Like

Thank you, skeller. I finally made it.

To sum up, 1) Use TZ environment variable, 2) The human-readable America/New_York form does not work for me, so I have to use Posix TZ Format, which is EST5EDT,M3.2.0/2:00:00,M11.1.0/2:00:00. I find it from Internet; hope it is correct. 3) The TZ environment variable takes effect immediately for date command on command line, but we need to restart GNOME to make it in effect for GNOME title. 4) since export spread environment variable across the system, I add export TZ='EST5EDT,M3.2.0/2:00:00,M11.1.0/2:00:00' in ~/.bashrc, and, forget not, logout and login to apply the TZ environment variable.

Many thanks to skeller.

image

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