Search code examples
javascriptdateepochdstgmt

Why does JavaScript Date(0) return 1am GMT+1 Jan 1st 1970?


I am in London (GMT time zone). We are currently in DST.

In the UK, Daylight Saving Time starts in March and ends in October, so Jan 1 1970 would have been outside DST.

However,

epochDate = new Date(0);
console.log(epochDate);

returns

Thu Jan 01 1970 01:00:00 GMT+0100 (Greenwich Mean Time)

I expected

Thu Jan 01 1970 00:00:00 GMT+0000 (Greenwich Mean Time)

Does Date(); return results in the current timezone?!


Solution

  • JavaScript Date(0) returns GMT+1 because, according to Wikipedia (and timeanddate.com), "the British Standard Time experiment, with Britain remaining on GMT+1 throughout the year… took place between 27 October 1968 and 31 October 1971"