Skip to content

Instantly share code, notes, and snippets.

@jngnyc
Last active April 12, 2018 14:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
window.WebhookUtils = {
upperCase: function (val) {
if (val) {
val = val.toUpperCase();
}
return val;
},
// Lowercase transformation:
lowerCase: function (val) {
if (val) {
val = val.toLowerCase();
}
return val;
},
// convert timestamp in UNIX time format to human-readable format
unixTimeToHumanReadable: function (val) {
var date = val;
// Hours part from the timestamp
var hours = date.getHours();
// Minutes part from the timestamp
var minutes = "0" + date.getMinutes();
// Seconds part from the timestamp
var seconds = "0" + date.getSeconds();
// Will display time in 10:30:23 format
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
return formattedTime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment