Skip to content

Instantly share code, notes, and snippets.

@bytorbrynden
Created May 31, 2016 18:37
Show Gist options
  • Save bytorbrynden/531ead85d548f177e861d16265907d6b to your computer and use it in GitHub Desktop.
Save bytorbrynden/531ead85d548f177e861d16265907d6b to your computer and use it in GitHub Desktop.
var getTime = function() {
var _date = new Date();
var hours = _date.getHours();
var minutes = _date.getMinutes();
var am_pm = (hours >= 12 ? "PM" : "AM");
return Math.round(hours / 12) + ":" + minutes + " " + am_pm;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment