TZ env var ignored in Windows Bash — date returns UTC instead of local time
Resolved 💬 1 comment Opened Apr 19, 2026 by saitoko Closed May 26, 2026
Problem
When running TZ=Asia/Tokyo date +%Y-%m-%d\ %H:%M:%S in Windows Bash (Git Bash / MSYS2), the TZ environment variable is silently ignored and UTC time is returned instead of the specified timezone.
Steps to Reproduce
On Windows with Git Bash:
TZ=Asia/Tokyo date +"%Y-%m-%d %H:%M:%S"
# Returns: 2026-04-19 13:39:49 ← UTC (wrong)
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
# Returns: 2026-04-19 22:40:28 ← JST (correct)
Expected Behavior
TZ=Asia/Tokyo date should return JST (UTC+9).
Actual Behavior
Returns UTC regardless of TZ setting. The offset is exactly 9 hours, confirming TZ is completely ignored.
Impact
Claude Code's global rules recommend using TZ=Asia/Tokyo date +%Y-%m-%d for JST-based timestamps. This guidance produces incorrect (UTC) results on Windows, causing 9-hour date/time errors in logs, filenames, and other time-sensitive operations.
Workaround
Use PowerShell instead:
powershell.exe -Command "Get-Date -Format 'yyyy-MM-dd HH:mm:ss'"
Environment
- OS: Windows 11 Pro
- Shell: Git Bash (MSYS2-based)
- Claude Code version: (latest)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗