javascript - Difference between UTC, GMT and Daylight saving time in JS -
i read lot of post , little confused utc, gmt , daylight saving time.
anyone can explain javascript date()
object utc, gmt , daylight saving time.
the main point want know is, when work date, need think or not daylight saving time.
and calculation of utc,gmt , daylight saving time same or not in different kind of programming languages.
utc standard, gmt time zone. utc uses same offset gmt, i.e. +00:00. interchangeable when discussing offsets.
all javascript (ecmascript) date objects use time value utc milliseconds since 1970-01-01t00:00:00z. when date constructor called without arguments, gets time , time zone offset host system , calculates time value. therefore, accuracy of generated date depends on accuracy of components.
when outputting date values using utc methods (e.g. getutchours, getutcminutes, etc.), vaules utc (gmt). when not using methods (e.g. gethours, getminutes, etc.) host system time zone offset used time value generate "local" values utc time value.
whether daylight saving applied or not depends on host system settings. whatever current rules host system time zone changes daylight saving applied dates, regardless of actual offset date (e.g. if dst starts on first sunday in october assumed have started on first sunday in october).
date object behaviour described in ecma-262 §20.3.2 , bit more (for parts) in mdn date.
Comments
Post a Comment