1.2 KiB
1.2 KiB
Git Bash TZ= is silently ignored on Windows — never use it for current-time reporting
Date: 2026-07-09 Source: Winter correction, Len's Auto browser-hijack thread (Discord bot session)
What happened
Reported "current time" to Winter as 4:40 PM AZ using
TZ="America/Phoenix" date '+... AZ' in Git Bash on BEAST. MSYS/Git-Bash has no
tzdata for that zone name, so TZ was silently ignored and the command printed
UTC (16:40) — which the format string then labeled "AZ". Real local time was
9:40 AM AZ. Winter caught it; caused a confusing side-quest about whether BEAST's
clock was a month off (it wasn't — clock + NTP + timezone all correct).
Rule
- For current date/time on a Windows machine: use PowerShell
Get-Date(system local time — BEAST is already set to Arizona), ordatein bash with NO TZ override (MSYS date honors the Windows local zone), or an external HTTPDate:header for authoritative UTC. - Never trust
TZ=<IANA zone>in Git Bash — unknown zones fall back to UTC with no error, and a hardcoded zone label in the format string turns that into a confidently-wrong answer. - Calendar math (
date -d 2026-06-05 +%A) is unaffected — that stays fine.