SQLite DateTime列のデフォルト値をJSTで設定する

列のデフォルトのタイムゾーンを日本標準時に設定する

DateColumn datetime default (DATETIME(‘now’,’localtime’))

※(DATETIME(‘now’,’localtime’)) と括弧で DATETIME(‘now’,’localtime’) を囲まないとエラーが出る

UTC の場合
DateColumn TIMESTAMP DEFAULT CURRENT_TIMESTAMP

カテゴリーPC

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

This site uses Akismet to reduce spam. Learn how your comment data is processed.