Converting DOMTimeStamp to localized HH:MM:SS MM-DD-YY via Javascript
问题 The W3C Geolocation API (among others) uses DOMTimeStamp for its time-of-fix. This is "milliseconds since the start of the Unix Epoch". What's the easiest way to convert this into a human readable format and adjust for the local timezone? 回答1: One version of the Date constructor takes the number of "milliseconds since the start of the Unix Epoch" as its first and only parameter. Assuming your timestamp is in a variable called domTimeStamp , the following code will convert this timestamp to