ゾーンへの変換
タイムゾーンを変更し、オフセットを更新して、Day.jsオブジェクトインスタンスを返します。
これを使用するには、Timezone
プラグインが必要です
dayjs.extend(utc)
dayjs.extend(timezone)
// this example runs in time zone 'Europe/Berlin' (offset +01:00)
dayjs("2013-11-18T11:55:20") // '2013-11-18T11:55:20+01:00'
dayjs("2013-11-18T11:55:20").tz("America/Toronto") // '2013-11-18T05:55:20-05:00'
dayjs("2013-11-18T11:55:20").tz("America/Toronto", true) // '2013-11-18T11:55:20-05:00'
2番目のパラメーターとしてtrueを渡すと、タイムゾーン(およびオフセット)のみが更新され、ローカル時間は同じに保たれます。