2013-10-25 73 views

回答

0
var date = new Date(); 

var year = date.getUTCFullYear(); 
var month = date.getUTCMonth(); 
var day = date.getUTCDate(); 

//month 2 digits 
month = ("0" + (month + 1)).slice(-2); 

//year 2 digits 
year = year.toString().substr(2,2); 

var formattedDate = day + '/' + month + "/" + year; 

打印25/10/13

+0

很好的答案,但如何使用date.now()?它比date.get –

+0

新Date()實例設置爲當前時間戳(現在)。 – sjkm