Skip to content

Instantly share code, notes, and snippets.

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
You can’t perform that action at this time.