Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var DotW = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Satruday' ];
var MotY = [ 'January', 'Feburary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
var dig2 = function(n) {
if (n > 9) return n.toString();
return "0" + n;
};
var formatDateUtc = function(date) {
var dddd = DotW[date.getUTCDay()];
var MMMM = MotY[date.getUTCMonth()];
var D = dig2(date.getUTCDate());
var YYYY = date.getUTCFullYear();
return dddd + ", " + MMMM + " " + D + ", " + YYYY;
};
var formatTimeUtc = function(date) {
var hh = dig2(date.getUTCHours());
var mm = dig2(date.getUTCMinutes());
return hh + ":" + mm;
};
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.