Local time (Definition)

The locale specific time value.

Availability:

ECMAScript edition - 2

Local time is the calendar time for the current locale.

Local time and UTC time differ by an amount derived by adding the Local Time Zone Adjustment and the Daylight Savings Time Adjustment together. Adding these to the UTC time gives the local time.

Conversion of UTC time (ut) to local time is defined by:

LocalTime(t) = ut + LocalTZA + DaylightSavingTA(ut)

Conversion from local time (lt) to UTC is defined by:

UTC(lt) = lt - LocalTZA - DaylightSavingTA(lt - LocalTZA)

The following expression may not always test true:

t = UTC(LocalTime(t))

Converting from UTC to local time and back may not yield an identical value due to deficiencies in daylight savings time computations. ECMA does not mandate that a compliant implementation needs to take DST into account only that it be aware that DST may be in force. Some locales use the same DST setting all year round in some years and that is difficult to predict and encapsulate into an algorithm.

See also:Broken down time, Calendar time, Date and time, Daylight savings time adjustment, Local time zone adjustment

Cross-references:

ECMA 262 edition 2 - section - 15.9.1.9

ECMA 262 edition 3 - section - 15.9.1.9