Created
November 10, 2016 02:05
-
-
Save mesuutt/ed0cc94ea0d143bbe446427b22827a1b to your computer and use it in GitHub Desktop.
Convert a timestamp to user's local time via JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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