Created
November 2, 2020 16:22
-
-
Save karan9/108595ce7e9d7602a5cc0b94f7665115 to your computer and use it in GitHub Desktop.
This file contains 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
var objectIdFromDate = function (date) { | |
return Math.floor(date.getTime() / 1000).toString(16) + "0000000000000000"; | |
}; | |
var dateFromObjectId = function (objectId) { | |
return new Date(parseInt(objectId.substring(0, 8), 16) * 1000); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment