Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 2004 19:37:47 +0100
From:      jimmy@loopia.se
To:        aeder@list.ru
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Timezone conversion
Message-ID:  <1101667067.41aa1afb03304@webbmail.loopia.se>
In-Reply-To: <41AA14D4.608@list.ru>
References:  <045701c4d543$2ff2c160$c600a8c0@i11> <41AA14D4.608@list.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting <aeder@list.ru>:
> Try the following:
> 1. Output date in seconds from epoch
>      SECONDS=$(date ...  "+%s")
> 2. Change the time zone.
>      TZ=CET
>       export TZ
>       date -r  $SECONDS

Yes, but I have dates in the format specified in the earlier mail (with a
different timezone-offset) and want to convert them to the current timezone.
The first step was just to get an example.

So 28 Nov 2004 12:02:18 +0000 in the example is not the current time, it is a
time which I got from an external source (and I can not assume that the date is
in UTC).

For your example to work the "..." would still have to include %z in its
format-string, and this doesn't seem to work (if I'm not doing something
stupid, if so please tell me).

Thanks for your response anyway. Any more takers?

Best regards,
Jimmy Mäkelä



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1101667067.41aa1afb03304>