طوابع زمنية JavaScript وسلاسل التاريخ تحويل الرموز إلى بعضها البعض (Super Simple)
<html xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8"/> <script typ DATE ()) ؛ TIMESTAMP = TIMESTAMP/ 1000 ؛ // الطابع الزمني الحالي هو: 1403149534CONSOLE.LOG ("الطابع الزمني الحالي هو:" + timestamp) ؛ // الحصول على الطابع الزمني بتنسيق زمني معين (NEWAMP2) /1000 ؛ // 2014-07-10 الطابع الزمني لـ 10:21:12 هو: 1404958872 Console.log (Stringtime + "Timestamp:" + timestamp2) ؛ // تغيير الوقت الحالي إلى سلسلة تنسيق الوقت var var timestamp3 = 140305804 ؛ var newDate = newDate () 2014 console.log (newDate.TodateString ()) ؛ // wed ، 18 يونيو 2014 02:33:24 GMT console.log (newdate.togmtstring ()) 2014-06-18t02: 33: 24.000z console.log (newdate.tojson ()) ؛ // 18 يونيو ، 2014 console.log (newdate.tolocaledateString ()) ؛ // 18 يونيو 2014 في 10:33:24 صباحًا console.log (newDate.Tolocalestring ()) console.log (newdate.tolocaletimestring ()) ؛ // Wed 18 Jun 2014 10:33:24 GMT+0800 (China Standard Time) Console.log (NewDate.ToString () 02:33:24 gmtconsole.log (newDate.ToutCstring ()) ؛ date.prototype.format = function (format) {var date = {"m+": this.getmonth ()+1 ، "d+": this.getDate () ، "h+": this.gethours () this.getSeconds () ، "q+": Math.Floor ((this.getMonth ()+3) / 3) ، "s+": this.getMillIseconds ()} ؛ if (/(y+)/i.test(format)) {format = format.replace (regexp. $ 1 ، (this.getlyear () + '') .Substr (4 - regexp. $ 1.Length)) ؛ } لـ (var k in date) {if (new regexp ("(" + k + ")). }} تنسيق الإرجاع ؛} console.log (newDate.Format ('Yyyy-MM-DD H: M: S')) ؛ </script>ما سبق هو المحتوى الكامل لوقت جافا سكريبت وقواعد تحويل سلسلة تاريخ (Super Simple) الذي قدمه لك المحرر. آمل أن يدعم الجميع wulin.com ~