Как использовать текущие данные в JavaScript
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
Xenophobic Xenomorph
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
To get time and date you should use
new Date().toLocaleString(); >> "09/08/2014, 2:35:56 AM"
To get only the date you should use
new Date().toLocaleDateString(); >> "09/08/2014"
To get only the time you should use
new Date().toLocaleTimeString(); >> "2:35:56 AM"