Javascript: Convert a UTC Date() object to the local timezone
问题 I have a Date() object that contains a UTC date, which I need converted to the users local timezone. Does anybody know how I could do this? :-) 回答1: I usually create a new Date object and use the Date.setUTC* functions to copy the date information. 回答2: I'm pretty sure it is done for you automatically. >>> d = new Date('Fri, 10 Jun 2011 19:49:23 UTC'); Sat Jun 11 2011 07:49:23 GMT+1200 (New Zealand Standard Time) >>> d.getHours(); 7 回答3: This is an old thread, but just in case anyone else