//事前設定
const dayjs = require('dayjs') // v1.9.7
dayjs.extend(require('dayjs/plugin/timezone'))
dayjs.extend(require('dayjs/plugin/utc'))
dayjs.tz.setDefault('Asia/Tokyo')
// 現在時刻
console.log(dayjs.tz().format())
// -> 2020-12-17T09:57:06+09:00
// from UTC
console.log(dayjs.utc('2020-12-17T00:00:00Z').local().format())
// -> 2020-12-17T09:00:00+09:00
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme