JavaScript ??? ??? ??? ??? ??? ??? ???? ????. 1. ?? ?? ??? ???? ?? UTC ??? ?? ? ??? ???? ?? ? ? ???? ?? ???? ???? ?? ????. 2. ??? ??? ??? ?? IANA ??? ??????? ???? ??? ?? ? ?? ??? ???? ??? ?? ?? ??? ? ????. 3. ????? ??? ??????? ?? ?????? ???? ???? intl.dateTimeFormat? ??? ? ????. 4. ?? ?? ??? Day.js? Timezone ? UTC ????? ???? API? ???? ??? ???? ??? ??? ?????.
JavaScript?? ??? ??? ??? ??? ??? ?? ??? ?? ?????? ???? ???? ????? ???? ??? ???? ????. JavaScript ?? Date
??? ????? ????? ???? ??? ?? ???? ??????, ?? ?? ? ??????? ??? ???? ????.

??? ??? ??? ? ? ???? ? ????? ???? ??? ????.
?? ?? ??? ?? ??
JavaScript? Date
??? ?? ?? ??, ??? ? ?? ? ? ????. ??? "PIT"? ????. ?? ??? ????? ???? ??????? ?? ???? ???????.

const now = ? ?? (); Console.log (??); // ??? ?? ?????
UTC ??? ???? .toUTCString()
?? .getUTCHours()
? ?? ??? ??? ? ????.
console.log (now.toutcstring ()); // UTC ???? ?????
??:

- ?? ?? ??? ??? ?? ?? ?? ? ??? UTC ??? ???? ?? ????.
- ????? ???? ???? ?? ??????.
Moment.js ? Moment-Timezon? ???? ??? ???? ??????
????? ?? ???? ????? ?? ?? ??? ?? ???? ?? ?? ??? ? ???? ?????. ?? Moment-TimeZone ??? ??? ? ????.
?? ?? (NPM) :
NPM ??? ?? ?? ??????
?? ?? :
const moment = require ( 'moment-timezone'); // ?? ???? ?? ??? ????. const newYorkTime = moment (). tz ( "America/New_York"). format (); Console.log (NewyorkTime);
?? :
- ??? IANA ??? ??????? ?????
- ??? ?? ???? ?? ???? ?? ? ? ????
????:
- Moment.js? ?? ?? ??? ????? ??? ????? ????? ?????. ??? ????? ??? ??? ? ????.
??? ? ??????? intl.dateTimeformat? ??????
?? ?????? ???? ???? ???? ???? ?? ???? ??? ????? ?? ? Intl.DateTimeFormat
? ??? ? ????.
const ?? = { ??? : '???/???', ?? : '??', ? : 'long', day : 'numeric', ?? : '2 ??', ? : '2 ??' }; const formatter = new intl.dateTimeformat ( 'Zh-CN', ??); console.log (formatter.format (new date ()); // ??? ??? ?????
? ??? ??? ?? ???? ???? ??? ???? ?? ??? ???? ??? ? ??? ????.
?? ?? ??? : Day.js Timezone ????
Day.js ? Moment.js ?????? ?? ??? ???? ??? ??? ????? ?? ??? ?? ????.
????:
NPM ?? dayjs npm @dayjs/plugin-timezone? ?????? npm @dayjs/plugin-utc? ??????
??:
const dayjs = require ( 'dayjs'); const utc = require ( '@dayjs/plugin-utc'); const timezone = require ( '@dayjs/plugin-timezone'); dayjs.extend (UTC); dayjs.extend (TimeZone); const beijingtime = dayjs (). tz ( '???/???'). ?? (); Console.log (Beijingtime);
??:
- ?? ??, ?? ??
- API? ???? ?? ??? ????
- UTC ? ??? ??? ?????
????? JavaScript? ??? ???? ???? ???? ???? ?? ??????? ?? ??????? ?? ??? ????? ????. ??? ?? ??? ???? ?? Intl
???? ?????. ???? ???? ????? Moment-Timezone ?? Day.js? ?? ?????.
????? ?? ??.
? ??? JavaScript?? ???? ???? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











???? ???? ? ???? ???? ????? ???. ???? UTC-12?? UTC+14?? 24?? ???? ????. ???? ?? ?? ?? ??? ?? ? ??? ???? ?? ??? ???? ???. PHP?? ? ?? ?? ???? ??? ??? ? ?? ?? ?? ??? ????.

??: time.Unix ??? ???? Unix ?????? ?? ???? ???? ???? ?????. Go ????? Unix ?????? ?? ? ?? ?? ???? ???? ?? ??? ??? ??? ??? ???? ?? ??? ????. ? ????? time ???? Unix ??? ???? ? ??? ???? ??? ???? ???? ???? ??? ?????. ??, Unix ?????? ??? ????? ???? ???. Unix ?????? 1970? 1? 1? ??? ??? ???? ? ??? ?????.

PHP?? ???? ???? ??: 1. ?? ???? ?? ???? ?? 8? ?????. 2. "date_default_timezone_set('Asia/Shanghai');" ??? ?? ???? ?????. 3. "date_default_timezone_set"? ?????. ('PHP ??? ?? PRC'? ??);".

???, ??? ?? ?? ? ??? ?? ??? ????? ??? ??? ?? ?? ? ??? ?? ??? ?? ????????. ?? ??? ??? ???? ?? ? ? ????? ????. ??? ?? ? ????. 1??: Tencent Meeting ?? ???? ???? ??? ?????(?? ??). 2??: ???? ? ?? ??? ???? ??? ?????(?? ??). 3??: ???? ????? ???(?? ??)? ?????. 4??: ???? ?????(?? ??). 5??: ??? ????? ???? ??(?? ??)? ?????.

PHP? ?? ?? ?? ??? ????? ?????. PHP? ???? ? ??????? ??? ?, PHP?? ???? ???? ?? ??? ????. PHP? ?? ???? "UTC(Coordinated Universal Time)"??, ?? ??? ??? ???? ?? ??? ?? ??? php.ini ???? ??? ??? ???? ???. ? ????? php.ini ???? ???? ???? ??? ?????.

Linux?? ???? ???? ??? ???? ????. 1. Linux ???? ????? ???? ?????. 2. ???? ????? ?? ??? ?????. 3. "hwclock --"? ?? ???? ??? ???. show" ??? ??? ?? ???? ??? ?????. 4. "vim /etc/timezone Asia/Shanghai"? ???? ???? ??? ? ????.

Go?? ???? ???? ??? ?????? ???? ????? time.LoadLocation? ?????. In ???? ???? ??? ??? ???? ?????. ??? ???? ?????? Format ???? ?????. ??? ??? ??? ?? ???? ?? ????? Parse ???? ?????. Header.Get("TimeZone")? ?? HTTP ???? ????? ???? ?????.

DateTime ?????? ?? PHPDateTime ???? ?????? ?? ??? ???? ?? ???, ????? UNIX ????? ???? 1970? 1? 1??? ??? ? ?? ?????. 00:00 UTC. ?????? ????: UTC ? ??? DateTime ?????? ???? ? ??? ????? UTC(?? ???) ???? ????? ????. ?? ??? ?? ?????? ?? ???? ?? ? ??? ?????. ?? ?? ??? ???(UTC-8)? ?????? ??? ?? ???? 8?? ????. ? ????? ????? DateTime::setTimestamp() ???? ???? ?? ??? ??? ? ????.
