Skip to content

Instantly share code, notes, and snippets.

@itspriddle
Created October 28, 2010 20:13
Show Gist options
  • Select an option

  • Save itspriddle/652245 to your computer and use it in GitHub Desktop.

Select an option

Save itspriddle/652245 to your computer and use it in GitHub Desktop.
/**
* jQuery Time Helpers
*
* @author Joshua Priddle <[email protected]>
* @copyright Copyright (c) 2010, ViaTalk, LLC
* @version 0.0.1
*/
;(function($) {
$.toTimestamp = function(seconds) {
var min = Math.floor(seconds / 60), sec = Math.floor(seconds % 60);
return [
min > 9 ? min : "0" + min,
sec > 9 ? sec : "0" + sec
].join(':');
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment