var expiredDate = $(obj).text(); $.console("pre expiredDate:" + expiredDate); expiredDate = expiredDate.replace(/-/g,"/"); $.console("expiredDate:" + expiredDate); var bmExpiredDate = new Date(Date.parse(expiredDate)); $.console(bmExpiredDate);輸出的結果:
日誌: pre expiredDate:2013-02-17 11:18:31
日誌: expiredDate:2013/02/17 11:18:31
日誌: Sun Feb 17 11:18:31 UTC+0800 2013
Reference: JavaScript and Dates, What a Mess!
沒有留言:
張貼留言
留個話吧:)