Bash

Convert Between Timezones

admin by @admin ADMIN
Jun 20, 2026
May 31, 2026
Public
0 0 up · 0 down Sign in to vote
Set TZ inline to print a date in a specific timezone, then read with another TZ. Avoids messing with the system timezone.
Bash
Raw
# What is "now" in another timezone
TZ=Asia/Tokyo date                          # current time in Tokyo
TZ="America/New_York" date +"%F %T %Z"      # 2025-03-12 15:25:00 EDT

# Convert a UTC stamp to local
date -d "2025-03-12T19:00:00Z" +"%F %T %Z"  # 2025-03-12 14:00:00 CDT (your TZ)

# Convert a date FROM one tz TO another (round-trip via UTC)
TZ=Asia/Tokyo date -d "2025-03-12 09:00" +%s | \
    xargs -I{} date -d @{} +"%F %T %Z"

# List available timezones
timedatectl list-timezones | grep -i tokyo
Tags

Save your own code snippets

Create a free account and build your private vault. Share publicly whenever you want.