0

I would like to convert a time specified as year month day hours minutes and seconds which is local to new york (for the new york stock exchange) into UTC times so that stock prices can be compared with other world trading in a global time frame. Note that I am not located in new york, so this is a non-local time zone. Also note that I need to do this for many dates of stock prices in the past, not just for the current time.

I was playing around with the Javascript Date object (on the server using node.js) but it seems to be missing non-local time zone support, particularly as I need to account for hour changes with regards to daylight savings etc.

There are a lot of questions asked on this time conversion topic but I have not seen one for javascript that offers a solution that takes into account DST. Mostly this question comes down to automatically knowing the hour offset from new york time to UTC for any given date in the past.

Robotbugs
  • 4,307
  • 3
  • 22
  • 30
  • Would this give you a good starting point? http://stackoverflow.com/questions/11887934/check-if-daylight-saving-time-is-in-effect-and-if-it-is-for-how-many-hours – Tamas May 10 '13 at 20:29
  • In what format do you receive the EDT time? I'm assuming you get it as a string? – Xotic750 May 10 '13 at 20:37
  • I can get it as a string. – Robotbugs May 10 '13 at 23:17
  • I see the problem. You would need to download the IANA database regularly and keep it updated in order to stay up to date with the time zones and times of DST for different localities. These libraries would then have to read that database to do the non-local time conversion. So I guess that is why the Date object only deals with local time. – Robotbugs May 10 '13 at 23:34

0 Answers0