How do I get current date in JavaScript?
How do I get the current date in JavaScript
De openkb
Sommaire |
Questions
Answers
Hendrik s answer in the comments above will work but probably isn t what you are looking for. The format is not very usable.
I have been having the same issue and have come up with this through a lot of searching.
var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10) { dd= 0 +dd } if(mm<10) { mm= 0 +mm } today = mm+ / +dd+ / +yyyy; document.write(today);
Source
License : cc by-sa 3.0
http://stackoverflow.com/questions/1531093/how-do-i-get-the-current-date-in-javascript