Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Last active August 29, 2015 14:05
Show Gist options
  • Save tadeubdev/969a249e68e3ac55f341 to your computer and use it in GitHub Desktop.
Save tadeubdev/969a249e68e3ac55f341 to your computer and use it in GitHub Desktop.
Utilizo essa função quando preciso retornar o time do JScript e calcular em segundos.
// Retorna o `Date.getTime()` removendo os milisegundos.
time = function()
{
return new Date().getTime().toString().substring(0,10);
};
// Ex.:
setInterval(function()
{
console.log( 'Time in seconds: ' + time() );
}, 1 * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment