2017-12-07 17 views

답변

0

내가 겨울에 순간

jun.tz('America/New_York').format('ha z'); // 8am EDT 
dec.tz('America/New_York').format('ha z'); // 7am EST 

에서 그렇게 할 수는 항상 동부 표준시 난

생각
1

언제든지 날짜 또는 시간과 같은 문제가 발생하면 원하는 결과를 얻으려면 일종의 날짜 클래스에 코드를 리팩터링하는 데 도움이됩니다. 다행히도 dateJS 날짜 및 시간을 다루는 자바 스크립트 라이브러리가 도움이 될 것입니다.

일광 절약 시간 표시와 관련하여이 예제는 원하는 것을 제공합니다.

는 getTimezoneAbbreviation

Date.getTimezoneAbbreviation (Number timezoneOffset, Boolean isDayLightSavingsTime) : String 

Returns a culture-specific timezone abbreviation based on a given offset and a boolean indicating whether daylight savings time is in effect. 

Parameters 
{Number timezoneOffset} The year. 
{Boolean isDayLightSavingsTime} Whether the date instance is observing Daylight Saving Time (Summer Time) 
Return Value 
{String} The timezone abbreviation 

Example 
var today = Date.today(); Date.getTimezoneAbbreviation(today.getTimezoneOffset, today.isDayLightSavingsTime()); // "UTC", "GMT", "EST", "PDT", etc.