GMTtime is a UNIX timestamp. The first line converts the timestamp to milliseconds, and the second line (theoretically) converts that number into a new date object.

My understanding is that date() returns a date object in the user's local time, but it's not working that way. It's consistently returning a time three hours ahead of my time (e.g. 3 am if it's midnight here - I'm in California).

The server is hosted in Montreal, which of course is eastern time zone. Is it possible the script is returning the local time for the server? But javascript is processed client-side, so this shouldn't happen, right?