Timezone conversion

jimmy at loopia.se jimmy at loopia.se
Sun Nov 28 10:37:52 PST 2004


Quoting <aeder at 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ä


More information about the freebsd-questions mailing list