1. การประทับเวลาการแปลงเวลา
คัดลอกรหัสรหัสดังต่อไปนี้:
ฟังก์ชันแปล (เวลาสิ้นสุด) {
var date=วันที่ใหม่();
date.setFullYear(endTime.substring(0,4));
date.setMonth(endTime.substring(5,7)-1);
date.setDate(endTime.substring(8,10));
date.setHours(endTime.substring(11,13));
date.setMinutes(endTime.substring(14,16));
date.setSeconds(endTime.substring(17,19));
กลับ Date.parse (วันที่) /1000;
-
2. เวลาในการแปลงการประทับเวลา
(1): แปลงเป็นรูปแบบ 2011-3-16 16:50:43:
คัดลอกรหัสรหัสดังต่อไปนี้:
ฟังก์ชั่น getDate (tm) {
var tt=new Date(parseInt(tm) * 1,000).toLocaleString().replace(/year|month/g, "-").replace(/日/g, " ")
กลับ TT;
-
(2): แปลงเป็นวันที่ 16 มีนาคม 2554 16:50:43 น.:
คัดลอกรหัสรหัสดังต่อไปนี้:
ฟังก์ชั่น getDate (tm) {
var tt=new Date(parseInt(tm) * 1,000).toLocaleString()
กลับ TT;
-
(3): แปลงเป็น 16:50 น. ของวันที่ 16 มีนาคม 2554
คัดลอกรหัสรหัสดังต่อไปนี้:
ฟังก์ชั่น getDate (tm) {
var tt=new Date(parseInt(tm) * 1,000).toLocaleString().substr(0,16);
กลับ TT;
-