Skip to content

Instantly share code, notes, and snippets.

@mesuutt
Created November 10, 2016 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mesuutt/ed0cc94ea0d143bbe446427b22827a1b to your computer and use it in GitHub Desktop.
Save mesuutt/ed0cc94ea0d143bbe446427b22827a1b to your computer and use it in GitHub Desktop.
Convert a timestamp to user's local time via JavaScript
function convertToLocalTimestamp(timestamp) {
var offset = new Date().getTimezoneOffset();
return timestamp + (60 * offset * 1000);
}
// convertToLocalTimestamp(1479168000000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment