Created
October 15, 2014 20:43
-
-
Save oriolrivera/be376756ce0848d1e5b9 to your computer and use it in GitHub Desktop.
jQuery Get Todays Date dd/mm/yyyy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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