Skip to content

Instantly share code, notes, and snippets.

@wdv4758h
Created May 22, 2014 06:15
Show Gist options
  • Save wdv4758h/57f29c72e96d05ef80d6 to your computer and use it in GitHub Desktop.
Save wdv4758h/57f29c72e96d05ef80d6 to your computer and use it in GitHub Desktop.
MySQL/MariaDB - Timezone

Timezone 轉換

使用 text values

先用以下這行指令建立 Table (會建立 timezone 相關資訊在 mysql 這個 database 底下的 table)

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u USER_NAME mysql

之後就可以使用像這樣的 SQL 來轉換 :

CONVERT_TZ(NOW(),'US/Pacific','UTC')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment