Created
December 13, 2021 20:36
-
-
Save akiyoshi83/e14080f1f4a1c61f3ca3cb00ec3e415e to your computer and use it in GitHub Desktop.
Docker image for conversion of time zones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE | |
# docker build -t tzconv . | |
# docker run tzconv "2022-01-01 00:00:00 JST" | |
# | |
# OPTIONAL: set alias to your shell configuration | |
# e.g. alias tzconv="docker run tzconv" | |
FROM ubuntu | |
RUN apt-get update && apt-get install tzdata | |
COPY tzconv.sh /tzconv.sh | |
RUN chmod +x /tzconv.sh | |
ENTRYPOINT ["/tzconv.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TZS=( | |
'UTC' | |
'Asia/Tokyo' | |
'America/Los_Angeles' | |
) | |
for tz in ${TZS[@]}; do | |
if [ "$1" == "" ]; then | |
TZ="${tz}" date "+%Y-%m-%d %H:%M:%S %Z" | |
else | |
TZ="${tz}" date "+%Y-%m-%d %H:%M:%S %Z" -d "$1" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment