GMT JST変換のスクリプト

GMT <-> JST 変換するスクリプト。仕事柄、しょっちゅう時差の計算をしないといけないので。

GMTからJSTへ変換 (プラス9時間するだけ)

#!/bin/bash
## GMT to JST
if [ $# -ne 1 ]; then
echo "Usage: $0 [\"yyyy/mm/dd 00:00]\""
fi
## if no arguments, shows date 9hours later from current
date -d "$1 9hours"

JSTからGMTへ変換 (マイナス9時間するだけ)

#!/bin/bash
## JST to GMT
if [ $# -ne 1 ]; then
echo "Usage: $0 [\"yyyy/mm/dd 00:00]\""
fi
## if no arguments, shows date 9hours before from current
date -d "$1 9hours ago"

以上。

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.