Direct answer
No supported per-shell time zone override exists in zsh/datetime. The module resolves zones through the host C library using the process-level TZ variable, and zsh provides no option or module parameter to bind a different zone to one shell instance. To avoid changing the parent process, run the date work in a child shell with TZ prefixed to the invocation.
Confirmed facts
zmodload zsh/datetime is required; the module is not always active by default.
EPOCHSECONDS, EPOCHREALTIME, strftime, and strptime inherit the process time zone from TZ or the system default when TZ is unset.
- Exporting
TZ changes the current shell and its children, but a child process cannot alter its parent's environment.
- zsh applies no separate offset or DST calendar; those rules come from libc and installed tzdata.
Steps for this case
- Load the module in the isolated shell:
zmodload zsh/datetime.
- Run formatting or parsing in a child process so the zone does not leak upward:
TZ=America/New_York zsh -c 'zmodload zsh/datetime; strftime "%Y-%m-%d %Z %z" $EPOCHSECONDS'
- If you own the current shell and can change its environment,
export TZ=America/New_York scopes the zone to that shell and its descendants only; the parent process remains unaffected.
Intended behavior when offsets or DST rules differ
When the regional offset or DST rules differ from the host default, the C library applies its own transition table for the named zone. zsh/datetime does not adjust, convert, or validate those rules. Output reflects libc behavior for the selected TZ, including any gaps or overlaps around DST transitions.
Constraints beyond libc
The module imposes no documented zone-selection mechanism beyond what libc offers. Additional limits are practical rather than architectural: zone-name availability, strptime specifier support, and DST edge cases depend on glibc, musl, BSD libc, the local tzdata package, and the zsh version in use.
Verification
zmodload zsh/datetime
strftime '%Y-%m-%d %Z %z' $EPOCHSECONDS
TZ=America/New_York zsh -c 'zmodload zsh/datetime; strftime "%Y-%m-%d %Z %z" $EPOCHSECONDS'
Compare the %Z and %z output between the parent shell and the child shell. They should differ when the zones differ.
Missing diagnostic detail
Can the script start a child shell? If process creation is blocked, there is no supported in-process workaround; state that constraint for a different recommendation.