Skip to content

Instantly share code, notes, and snippets.

@oriolrivera
Created October 15, 2014 20:43
Show Gist options
  • Save oriolrivera/be376756ce0848d1e5b9 to your computer and use it in GitHub Desktop.
Save oriolrivera/be376756ce0848d1e5b9 to your computer and use it in GitHub Desktop.
jQuery Get Todays Date dd/mm/yyyy
var fullDate = new Date()
console.log(fullDate);
//Thu Otc 15 2014 17:25:38 GMT+1000 {}
//convert month to 2 digits
var twoDigitMonth = ((fullDate.getMonth().length+1) === 1)? (fullDate.getMonth()+1) :(fullDate.getMonth()+1);
var currentDate = fullDate.getDate() + "/" + twoDigitMonth + "/" + fullDate.getFullYear();
console.log(currentDate);
//15/10/2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment