Skip to content

Instantly share code, notes, and snippets.

@bertrandom
Created March 1, 2016 08:25
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 bertrandom/05be70b43e0ed1ebf907 to your computer and use it in GitHub Desktop.
Save bertrandom/05be70b43e0ed1ebf907 to your computer and use it in GitHub Desktop.
var moment = require('moment');
module.exports = {
convertTimeToTimestamp: function (time) {
return moment.utc(time, "HH:mm:ss,SSS").set({'year':1970, 'month':0, 'date':1}).valueOf();
},
convertTimestampToTime: function (timestamp) {
return moment.utc(timestamp, 'x').format("HH:mm:ss,SSS");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment