{"id":274,"date":"2012-08-27T12:12:00","date_gmt":"2012-08-27T04:12:00","guid":{"rendered":"http:\/\/gaigaiming.com\/?p=274"},"modified":"2012-08-27T12:12:00","modified_gmt":"2012-08-27T04:12:00","slug":"javascript%e6%97%b6%e9%97%b4%e6%88%b3%e4%b8%8e%e5%85%b6%e6%a0%bc%e5%bc%8f%e5%8c%96%e8%bd%ac%e6%8d%a2%e7%9a%84%e6%96%b9%e6%b3%95%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/www.gaigaiming.com\/index.php\/2012\/08\/27\/javascript%e6%97%b6%e9%97%b4%e6%88%b3%e4%b8%8e%e5%85%b6%e6%a0%bc%e5%bc%8f%e5%8c%96%e8%bd%ac%e6%8d%a2%e7%9a%84%e6%96%b9%e6%b3%95%e6%80%bb%e7%bb%93\/","title":{"rendered":"JavaScript\u65f6\u95f4\u6233\u4e0e\u5176\u683c\u5f0f\u5316\u8f6c\u6362\u7684\u65b9\u6cd5\u603b\u7ed3"},"content":{"rendered":"<div>\n<p><a href=\"http:\/\/www.nowamagic.net\/librarys\/veda\/detail\/399\" target=\"_blank\" rel=\"noopener\">http:\/\/www.nowamagic.net\/librarys\/veda\/detail\/399<\/a><\/p>\n<p>var&nbsp;day1&nbsp;=&nbsp;parseInt(new&nbsp;Date().valueOf()\/1000);<br \/>var&nbsp;day2&nbsp;=&nbsp;new&nbsp;Date(day1&nbsp;*&nbsp;1000);<\/p>\n<p>&nbsp;<\/p>\n<p>function&nbsp;getLocalTime(nS)&nbsp;{&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;Date(parseInt(nS)&nbsp;*&nbsp;1000).toLocaleString().replace(\/:d{1,2}$\/,&#39;&nbsp;&#39;);&nbsp;&nbsp;<br \/>}<\/p>\n<p>&nbsp;<\/p>\n<p>function&nbsp;getLocalFormatTime(nS)&nbsp;{&nbsp;&nbsp;<br \/>&nbsp;return&nbsp;new&nbsp;Date(parseInt(nS)&nbsp;*&nbsp;1000).toLocaleString().replace(\/\u5e74|\u6708\/g,&nbsp;&quot;-&quot;).replace(\/\u65e5\/g,&nbsp;&quot;&nbsp;&quot;);&nbsp;&nbsp;&nbsp;<br \/>}<\/p>\n<p>&nbsp;<\/p>\n<p>document.getElementById(&quot;btn5&quot;).onclick&nbsp;=&nbsp;function(){<br \/>&nbsp;alert(day2.getFullYear()+&quot;-&quot;+(day2.getMonth()+1)+&quot;-&quot;+day2.getDate()+&quot;&nbsp;&quot;+day2.getHours()+&quot;:&quot;+day2.getMinutes()+&quot;:&quot;+day2.getSeconds());<br \/>}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;script&nbsp;type=&quot;text\/javascript&quot;&gt;<br \/>var&nbsp;day1&nbsp;=&nbsp;parseInt(new&nbsp;Date().valueOf()\/1000);<br \/>var&nbsp;day2&nbsp;=&nbsp;new&nbsp;Date(day1&nbsp;*&nbsp;1000);<\/p>\n<p>function&nbsp;getLocalTime(nS)&nbsp;{&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;Date(parseInt(nS)&nbsp;*&nbsp;1000).toLocaleString().replace(\/:d{1,2}$\/,&#39;&nbsp;&#39;);&nbsp;&nbsp;<br \/>}&nbsp;<\/p>\n<p>\/*&nbsp;\u540c\u4e0a\u9762\u51fd\u6570&nbsp;*\/<br \/>function&nbsp;getLocalTimes(nS)&nbsp;{&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;Date(parseInt(nS)&nbsp;*&nbsp;1000).toLocaleString().substr(0,17);<br \/>}&nbsp;&nbsp;<\/p>\n<p>function&nbsp;getLocalFormatTime(nS)&nbsp;{&nbsp;&nbsp;<br \/>&nbsp;return&nbsp;new&nbsp;Date(parseInt(nS)&nbsp;*&nbsp;1000).toLocaleString().replace(\/\u5e74|\u6708\/g,&nbsp;&quot;-&quot;).replace(\/\u65e5\/g,&nbsp;&quot;&nbsp;&quot;);&nbsp;&nbsp;&nbsp;<br \/>}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>document.getElementById(&quot;btn1&quot;).onclick&nbsp;=&nbsp;function(){<br \/>&nbsp;alert(day1);<br \/>}<\/p>\n<p>document.getElementById(&quot;btn2&quot;).onclick&nbsp;=&nbsp;function(){<br \/>&nbsp;alert(day2.toLocaleString());<br \/>}<\/p>\n<p>document.getElementById(&quot;btn3&quot;).onclick&nbsp;=&nbsp;function(){<br \/>&nbsp;alert(&nbsp;getLocalTime(day1)&nbsp;);<br \/>}<\/p>\n<p>document.getElementById(&quot;btn4&quot;).onclick&nbsp;=&nbsp;function(){<br \/>&nbsp;alert(&nbsp;getLocalFormatTime(day1)&nbsp;);<br \/>}<\/p>\n<p>document.getElementById(&quot;btn5&quot;).onclick&nbsp;=&nbsp;function(){<br \/>&nbsp;alert(day2.getFullYear()+&quot;-&quot;+(day2.getMonth()+1)+&quot;-&quot;+day2.getDate()+&quot;&nbsp;&quot;+day2.getHours()+&quot;:&quot;+day2.getMinutes()+&quot;:&quot;+day2.getSeconds());<br \/>}<br \/>&lt;\/script&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/www.nowamagic.net\/librarys\/veda\/detail\/399 var&#038;n [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-274","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/posts\/274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":0,"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gaigaiming.com\/index.php\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}