Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is there a way to get the “full” time zone currently in use?



How about

    readlink /etc/localtime

?

On Fri, Jul 27, 2018 at 9:13 AM TJ Luoma <luomat@xxxxxxxxx> wrote:

> Hello Zsh Friends,
>
> I am trying to use zsh to find the current time-zone that the computer
> uses.
>
> I know that this:
>
> `strftime "%Z" "$EPOCHSECONDS"`
>
> will show me the current timezone (EDT, in my case) but I'm looking for
> "America/New_York"
>
> The only way that I can find to get that information on the Mac is
>
> `sudo systemsetup -gettimezone`
>
> but it seems absurd to need to use `sudo` to get that information.
>
> I searched the web and found that the variable "TZ" is supposed to hold
> this command, but TZ is empty in my testing on my Macs, so that's no help
> either.
>
> I've got to imagine that there's _some_ way to do this, but I'm stuck
> trying to figure it out.
>
> Anyone have a solution?
>
> Thanks for your time
>
> Tj
>
>
> --
> TJ Luoma
> TJ @ MacStories
> Personal Website: luo.ma (aka RhymesWithDiploma.com)
> Twitter: @tjluoma
>


Messages sorted by: Reverse Date, Date, Thread, Author