Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Created September 8, 2011 12:28
Show Gist options
  • Save oivoodoo/1203278 to your computer and use it in GitHub Desktop.
Save oivoodoo/1203278 to your computer and use it in GitHub Desktop.
(function(global) {
global.DateTime = DateTime = {};
DateTime.instance = (function() {
return {
getTime: function(date, gmt_offset) {
var date = DateTime.instance.getDate(date, gmt_offset);
return date.getHours() + ":" + date.getMinutes();
},
getDate: function(date, gmt_offset) {
var offset = -((new Date().getTimezoneOffset()) * 60 + gmt_offset);
return new Date(date.getTime() - offset * 1000);
}
};
})();
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment