Skip to content

Instantly share code, notes, and snippets.

@jmcabandara
Forked from oriolrivera/today.js
Created October 11, 2016 05:12
Show Gist options
  • Save jmcabandara/ee13a43a7622a85eda2072d107870fee to your computer and use it in GitHub Desktop.
Save jmcabandara/ee13a43a7622a85eda2072d107870fee 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