Neither of those two solutions are correct. They only work in a some cases. You need a more advanced detection algorithm for this. Preferably one based on the Olson database, since time zones have changed over the years and you want to be able to display past dates correctly.
This solution linked from your second link looks more correct.
http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp
http://www.onlineaspect.com/2007/06/08/auto-detect-a-time-zo...