在指定時區解析
在指定時區解析日期時間字串,並返回一個 Day.js 實例。
TIP
這需要 Timezone 插件才能正常工作。
javascript
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.tz('2013-11-18T11:55:20', 'America/Toronto'); // '2013-11-18T11:55:20-05:00'
若您已知輸入字串的格式,可以使用該格式解析日期。參數與 String + Format 相同。
TIP
這需要 CustomParseFormat 插件支援。
javascript
dayjs.extend(customParseFormat);
dayjs.tz('12-25-1995', 'MM-DD-YYYY', 'America/Toronto');