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.
Prev | Home | Next |
LiveWire | Up | Local time zone adjustment |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |