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

Timezones and print -P %D



Can someone explain what's going on here?  I was under the impression that variable assignments on the command-line were exported to the environment and only effective for the life of the command.

cdblinux[~]% unset TZ
cdblinux[~]% print -P '%D{%Y-%m-%dT%H:%M%z}'
2020-11-12T13:32-0600
cdblinux[~]% TZ=UTC print -P '%D{%Y-%m-%dT%H:%M%z}'
2020-11-12T13:33-0600
cdblinux[~]% export TZ
cdblinux[~]% TZ=UTC print -P '%D{%Y-%m-%dT%H:%M%z}'
2020-11-12T19:33+0000
cdblinux[~]% print -P '%D{%Y-%m-%dT%H:%M%z}'
2020-11-12T19:33+0000
cdblinux[~]% unset TZ
cdblinux[~]% print -P '%D{%Y-%m-%dT%H:%M%z}'
2020-11-12T13:33-0600
cdblinux[~]% cat /etc/system-release
CentOS Linux release 8.2.2004 (Core)
cdblinux[~]% uname -a
Linux cdblinux.cfhp.com 4.18.0-193.14.2.el8_2.x86_64 #1 SMP Sun Jul 26 03:54:29 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
cdblinux[~]% echo $ZSH_VERSION
5.5.1





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