coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the current time in time zone represented by strings like


From: Peng Yu
Subject: Re: How to get the current time in time zone represented by strings like +0100?
Date: Thu, 16 May 2024 08:31:15 -0500

My understanding in the last email is wrong.

So +02:00 in your example is actually -0200 in my example, can date
take the meaning "+" as in my original example? Or I will have to flip
the signs myself?

$ TZ=Europe/Paris date
Thu May 16 15:27:48 CEST 2024
$ TZ='XXX+02:00' date
Thu May 16 11:28:06 XXX 2024

On Thu, May 16, 2024 at 8:24 AM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> On Wed, May 15, 2024 at 12:04 AM Grisha Levit <grishalevit@gmail.com> wrote:
> >
> > On Tue, May 14 2024 at 16:05 Peng Yu wrote:
> > > For example, in the time zone represented by +0100, how to get its
> > > current time from date using '+0100' as input? Thanks.
> >
> > Use the offset to create a timezone specification, supplied in the TZ
> > environment variable.
> >
> >     TZ='XXX-01:00' date
>
> Strings like +0100 is relative to UTC. For example, +0100 is Central
> European Time. I guess that you understood +0100 as relative to my
> current timezone.
>
> How to achieve +0100 as relative to UTC with date?
>
> > The `XXX` is an arbitrary (required) name. Note that the sign of the
> > offset has the opposite of its usual meaning. The full format can be
> > found in the tzset(3) man page.
>
> --
> Regards,
> Peng



-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]