如何在JavaScript中像這樣格式化日期和時間?
格式日期時間JavaScript
2012年3月5日14:30 @(UTC - 9:30)
我用這個代碼來計算EST時間:
function getDate() {
var now = new Date();
var utc = now.getTime() + (now.getTimezoneOffset() * 60000);
return new Date(utc + (3600000 * -4));
}
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date – Corbin 2012-03-14 20:44:46
嗨,希望這會有所幫助, - http://blog.stevenlevithan.com/archives/date-time-format,歡呼聲 – 2012-03-14 20:45:58
@Tats_innit它確實,謝謝 – Shahin 2012-03-14 21:03:41