JavaScriptタイムスタンプと日付の文字列コードを互いに変換する(超単純)
<html xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <スクリプト= date());タイムスタンプ=タイムスタンプ/ 1000; //現在のタイムスタンプは1403149534Console.log( "現在のタイムスタンプは:" +タイムスタンプ); /1000; // 2014-07-10 10:21:12のタイムスタンプは1404958872 Console.log(Stringtime + "Timestamp:" + Timestamp2); 2014 Console.log(newdate.todatestring()); //水、2014年6月18日02:33:24 GMT Console.log(newdate.TogmtString(); 2014-06-18T02:33:24.000Z Console.log(newdate.tojson()); // 2014年6月18日Console.log(newdate.tolocaledatestring()); console.log(newdate.tolocaletimestring()); //水曜日2014年6月18日10:33:24 GMT+0800(中国標準時間)Console.log(newdate.toString()); // 10:33:24 GMT+0800(中国標準時間)コンソール02:33:24 gmtconsole.log(newdate.toutcstring()); date.prototype.format(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.getTullear() + '').substr(4 -regexp。$ 1. length)); } for(var k in date){if(new regexp( "(" + k + ")")。test(format)){format = format.replace(regexp。$ 1、regexp。 }} return format;} console.log(newdate.format( 'yyyy-mm-dd h:m:s')); </script>上記は、編集者からもたらされたJavaScriptタイムスタンプおよび日付文字列変換コード(超単純)の完全なコンテンツです。誰もがwulin.comをサポートすることを願っています〜