Skip to content

Instantly share code, notes, and snippets.

@itsalb3rt
Created December 28, 2018 22:18
Show Gist options
  • Save itsalb3rt/7d0f9643b707ecf146d1aba544236324 to your computer and use it in GitHub Desktop.
Save itsalb3rt/7d0f9643b707ecf146d1aba544236324 to your computer and use it in GitHub Desktop.
obtener fecha y tiempo con javascript
/**
* Reotorna fecha en formato yyyy-mm-dd hh:ii:ss
**/
function get_date_time(){
let date = new Date().toISOString().slice(0, 10);
let time = new Date();
let hours = time.getHours();
let minutes = time.getMinutes();
let seconds = time.getSeconds();
return date + ' ' + hours + ':' + minutes + ':' + seconds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment