{"id":1070,"date":"2016-09-08T20:04:29","date_gmt":"2016-09-08T11:04:29","guid":{"rendered":"https:\/\/cs-tklab.na-inet.jp\/?p=1070"},"modified":"2016-09-08T20:59:56","modified_gmt":"2016-09-08T11:59:56","slug":"%e5%8d%92%e7%a0%94%e3%83%a1%e3%83%a2-php%e3%81%a8javascript%e3%81%ab%e3%82%88%e3%82%8b%e6%97%a5%e4%bb%98%e5%b7%ae%e3%81%ae%e8%a8%88%e7%ae%97","status":"publish","type":"post","link":"https:\/\/kd-tklab.na-inet.jp\/?p=1070","title":{"rendered":"[\u5352\u7814\u30e1\u30e2] PHP\u3068JavaScript\u306b\u3088\u308b\u65e5\u4ed8\u5dee\u306e\u8a08\u7b97"},"content":{"rendered":"<p>\u3000\u9577\u6642\u9593\u306b\u308f\u305f\u308b\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30c6\u30b9\u30c8\u306e\u958b\u59cb\u65e5\u6642\u3068\u7d42\u4e86\u65e5\u6642\u306e\u5dee\u3092\u5c0e\u51fa\u3059\u308b\u5fc5\u8981\u306b\u8feb\u3089\u308c\u305f\u306e\u3067\uff0cPHP\u3068JavaScript\u3067\u305d\u308c\u305e\u308c\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p><a href=\"http:\/\/cs-tklab.na-inet.jp\/~tkouya\/diff_dates.php\" target=\"_blank\">http:\/\/cs-tklab.na-inet.jp\/~tkouya\/diff_dates.php<\/a><\/p><\/blockquote>\n<p>\u3000\u53c2\u8003\u306b\u3057\u305f\u306e\u306f\uff0cQiita\u306e<a href=\"http:\/\/qiita.com\/kazu56\/items\/cca24cfdca4553269cab\">\u3053\u3061\u3089(JavaScript)<\/a>\u3068<a href=\"http:\/\/qiita.com\/re-24\/items\/c3ed814f2e1ee0f8e811\">\u3053\u3061\u3089(PHP)<\/a>\u3067\u3059\u3002<\/p>\n<p>\u3000\u3068\u3053\u308d\u3067\uff0cPHP\u3068JavaScript\u3068\u3067\u5dee\u304c\u51fa\u308b\u3053\u3068\u304c\u3042\u308b\u3093\u3067\u3059\u304c\uff0c\u3053\u306e\u8fba\u306e\u7406\u5c48\u304c\u3088\u304f\u5206\u304b\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/cs-tklab.na-inet.jp\/blog\/wp-content\/uploads\/2016\/09\/2016-09-08_204438.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1071\" data-permalink=\"https:\/\/kd-tklab.na-inet.jp\/?attachment_id=1071\" data-orig-file=\"https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204438.png?fit=248%2C517&amp;ssl=1\" data-orig-size=\"248,517\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2016-09-08_204438\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204438.png?fit=248%2C517&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/cs-tklab.na-inet.jp\/blog\/wp-content\/uploads\/2016\/09\/2016-09-08_204438-144x300.png?resize=144%2C300&#038;ssl=1\" alt=\"2016-09-08_204438\" width=\"144\" height=\"300\" class=\"alignnone size-medium wp-image-1071\" srcset=\"https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204438.png?resize=144%2C300&amp;ssl=1 144w, https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204438.png?w=248&amp;ssl=1 248w\" sizes=\"auto, (max-width: 144px) 100vw, 144px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/cs-tklab.na-inet.jp\/blog\/wp-content\/uploads\/2016\/09\/2016-09-08_204451.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1072\" data-permalink=\"https:\/\/kd-tklab.na-inet.jp\/?attachment_id=1072\" data-orig-file=\"https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204451.png?fit=261%2C454&amp;ssl=1\" data-orig-size=\"261,454\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2016-09-08_204451\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204451.png?fit=261%2C454&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/cs-tklab.na-inet.jp\/blog\/wp-content\/uploads\/2016\/09\/2016-09-08_204451-172x300.png?resize=172%2C300&#038;ssl=1\" alt=\"2016-09-08_204451\" width=\"172\" height=\"300\" class=\"alignnone size-medium wp-image-1072\" srcset=\"https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204451.png?resize=172%2C300&amp;ssl=1 172w, https:\/\/i0.wp.com\/kd-tklab.na-inet.jp\/wp-content\/uploads\/2016\/09\/2016-09-08_204451.png?w=261&amp;ssl=1 261w\" sizes=\"auto, (max-width: 172px) 100vw, 172px\" \/><\/a><\/p>\n<p>\u3000\u897f\u66a6\u306e\u307f\u5909\u3048\u3066\uff0c\u540c\u4e00\u65e5\u6642\u3067\u8a08\u7b97\u3059\u308b\u30682\u65e5\u5206\u3060\u3051\u8a08\u7b97\u5024\u304c\u30ba\u30ec\u307e\u3059\u3002\u3069\u3063\u3061\u304c\u6b63\u3057\u3044\u306e\u304b\u3057\u3089\u3093\uff1f\u3000\u7406\u5c48\u304c\u5206\u304b\u308b\u65b9\uff0c\u304a\u77e5\u3089\u305b\u4e0b\u3055\u3044\u3002\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306b\u4e0a\u3052\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-title=\"diff_dates.php\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;ja&quot;&gt;\r\n&lt;head&gt;\r\n\t&lt;meta charset=&quot;UTF-8&quot; \/&gt;\r\n\t&lt;title&gt;Derive the difference of two dates&lt;\/title&gt;\r\n\t&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\t\t\/\/ \u73fe\u5728\u6642\u523b\u306e\u53d6\u5f97\r\n\t\tvar now_fulldate = new Date();\r\n\t\tvar now_year = now_fulldate.getFullYear();\r\n\t\tvar now_month = now_fulldate.getMonth() + 1;\r\n\t\tvar now_date = now_fulldate.getDate();\r\n\t\tvar now_hour = now_fulldate.getHours();\r\n\t\tvar now_minute = now_fulldate.getMinutes();\r\n\t\tvar now_second = now_fulldate.getSeconds();\r\n\t&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;\u65e5\u4ed8\u306e\u5dee\u306e\u8a08\u7b97&lt;\/h1&gt;\r\n&lt;h2&gt;Last Update: 2016-09-08(Thu)&lt;\/h2&gt;\r\n&lt;hr \/&gt;\r\n&lt;!-- 2\u3064\u306e\u30d5\u30a9\u30fc\u30e0 --&gt;\r\n&lt;p&gt;\r\n&lt;!-- PHP\u7248 --&gt;\r\n&lt;div style=&quot;border: solid; float: left; width: 45%; padding: 10px;&quot;&gt;\r\n&lt;h2&gt;PHP\u7248&lt;\/h2&gt;\r\n\t&lt;form id=&quot;php_form&quot; method=&quot;POST&quot;&gt;\r\n\t&lt;h3&gt;\u65e5\u4ed8\u30fb\u6642\u523b1: Date1&lt;\/h3&gt;\r\n\t\t&lt;p&gt;\r\n\t\t\t\u897f\u66a6\u5e741   : &lt;input type=&quot;text&quot; size=&quot;6&quot; id=&quot;year1&quot; name=&quot;year1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u67081(1\uff5e12): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;month1&quot; name=&quot;month1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u65e51(1\uff5e31): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;date1&quot; name=&quot;date1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u66421(0\uff5e23): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;hour1&quot; name=&quot;hour1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u52061(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;minute1&quot; name=&quot;minute1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u79d21(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;second1&quot; name=&quot;second1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t&lt;\/p&gt;\r\n\t&lt;h3&gt;\u65e5\u4ed8\u30fb\u6642\u523b2: Date2&lt;\/h3&gt;\r\n\t\t&lt;p&gt;\r\n\t\t\t\u897f\u66a6\u5e742   : &lt;input type=&quot;text&quot; size=&quot;6&quot; id=&quot;year2&quot; name=&quot;year2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u67082(1\uff5e12): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;month2&quot; name=&quot;month2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u65e52(1\uff5e31): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;date2&quot; name=&quot;date2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u66422(0\uff5e23): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;hour2&quot; name=&quot;hour2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u52062(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;minute2&quot; name=&quot;minute2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u79d22(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;second2&quot; name=&quot;second2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t&lt;\/p&gt;\r\n\t\t&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;\u5165\u529b\u5b8c\u4e86&quot; \/&gt; &lt;input type=&quot;reset&quot; value=&quot;\u6d88\u53bb&quot; \/&gt;&lt;\/p&gt;\r\n\t\t&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\t\t\tdocument.getElementById(&#039;year1&#039;).value = now_year;\r\n\t\t\tdocument.getElementById(&#039;month1&#039;).value = now_month;\r\n\t\t\tdocument.getElementById(&#039;date1&#039;).value = now_date;\r\n\t\t\tdocument.getElementById(&#039;hour1&#039;).value = now_hour;\r\n\t\t\tdocument.getElementById(&#039;minute1&#039;).value = now_minute;\r\n\t\t\tdocument.getElementById(&#039;second1&#039;).value = now_second;\r\n\r\n\t\t\tdocument.getElementById(&#039;year2&#039;).value = now_year;\r\n\t\t\tdocument.getElementById(&#039;month2&#039;).value = now_month;\r\n\t\t\tdocument.getElementById(&#039;date2&#039;).value = now_date;\r\n\t\t\tdocument.getElementById(&#039;hour2&#039;).value = now_hour;\r\n\t\t\tdocument.getElementById(&#039;minute2&#039;).value = now_minute;\r\n\t\t\tdocument.getElementById(&#039;second2&#039;).value = now_second;\r\n\t\t&lt;\/script&gt;\r\n\t&lt;\/form&gt;\r\n\t&lt;?php \r\n\t\tif(!empty($_POST[&#039;year1&#039;]) &amp;&amp; !empty($_POST[&#039;month1&#039;]) &amp;&amp; !empty($_POST[&#039;date1&#039;]) &amp;&amp; !empty($_POST[&#039;hour1&#039;]) &amp;&amp; !empty($_POST[&#039;minute1&#039;]) &amp;&amp; !empty($_POST[&#039;second1&#039;]) &amp;&amp; !empty($_POST[&#039;year2&#039;]) &amp;&amp; !empty($_POST[&#039;month2&#039;]) &amp;&amp; !empty($_POST[&#039;date2&#039;]) &amp;&amp; !empty($_POST[&#039;hour2&#039;]) &amp;&amp; !empty($_POST[&#039;minute2&#039;]) &amp;&amp; !empty($_POST[&#039;second2&#039;]))\r\n\t\t{\r\n\t\t\t$date1 = new DateTime( htmlspecialchars($_POST[&#039;year1&#039;]) . &#039;-&#039; . htmlspecialchars($_POST[&#039;month1&#039;]) . &#039;-&#039; . htmlspecialchars($_POST[&#039;date1&#039;]) . &#039; &#039; . htmlspecialchars($_POST[&#039;hour1&#039;]) . &#039;:&#039; . htmlspecialchars($_POST[&#039;minute1&#039;]) . &#039;:&#039; . htmlspecialchars($_POST[&#039;second1&#039;]) );\r\n\t\t\t$date2 = new DateTime( htmlspecialchars($_POST[&#039;year2&#039;]) . &#039;-&#039; . htmlspecialchars($_POST[&#039;month2&#039;]) . &#039;-&#039; . htmlspecialchars($_POST[&#039;date2&#039;]) . &#039; &#039; . htmlspecialchars($_POST[&#039;hour2&#039;]) . &#039;:&#039; . htmlspecialchars($_POST[&#039;minute2&#039;]) . &#039;:&#039; . htmlspecialchars($_POST[&#039;second2&#039;]) );\r\n\t\t\tif(!empty($date1) &amp;&amp; !empty($date2))\r\n\t\t\t{\r\n\t\t?&gt;\r\n\t\t\t&lt;h3&gt;\u51fa\u529b&lt;\/h3&gt;\r\n\t\t\t&lt;p&gt;\r\n\t\t&lt;?php\r\n\t\t\t\techo &#039;Date1: &#039; . $date1-&gt;format(&#039;Y-m-d H:i:s&#039;) . &quot;&lt;br \/&gt;\\n&quot;;\r\n\t\t\t\techo &#039;Date2: &#039; . $date2-&gt;format(&#039;Y-m-d H:i:s&#039;) . &quot;&lt;br \/&gt;\\n&quot;;\r\n\t\t\t\t$diff = $date2-&gt;diff($date1);\r\n\t\t\t\techo &#039;Date1 - Date2: &#039; . $diff-&gt;format(&#039;%R %y-%m-%d %h:%i:%s&#039;) . &quot;&lt;br \/&gt;\\n&quot;;\r\n\t\t?&gt;\r\n\t\t\t&lt;\/p&gt;\r\n\t&lt;?php\r\n\t\t\t}\r\n\t}\r\n\t?&gt;\r\n&lt;\/div&gt;\r\n\r\n&lt;!-- JavaScript\u7248 --&gt;\r\n&lt;div style=&quot;border: solid; float: left; width: 45%; padding: 10px;&quot;&gt;\r\n&lt;h2&gt;JavaScript\u7248&lt;\/h2&gt;\r\n\t&lt;form id=&quot;js_form&quot; method=&quot;POST&quot;&gt;\r\n\t&lt;h3&gt;\u65e5\u4ed8\u30fb\u6642\u523b1: Date1&lt;\/h3&gt;\r\n\t\t&lt;p&gt;\r\n\t\t\t\u897f\u66a6\u5e741   : &lt;input type=&quot;text&quot; size=&quot;6&quot; id=&quot;js_year1&quot; name=&quot;js_year1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u67081(1\uff5e12): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_month1&quot; name=&quot;js_month1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u65e51(1\uff5e31): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_date1&quot; name=&quot;js_date1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u66421(0\uff5e23): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_hour1&quot; name=&quot;js_hour1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u52061(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_minute1&quot; name=&quot;js_minute1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u79d21(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_second1&quot; name=&quot;js_second1&quot; \/&gt;&lt;br \/&gt;\r\n\t\t&lt;\/p&gt;\r\n\t&lt;h3&gt;\u65e5\u4ed8\u30fb\u6642\u523b2: Date2&lt;\/h3&gt;\r\n\t\t&lt;p&gt;\r\n\t\t\t\u897f\u66a6\u5e742   : &lt;input type=&quot;text&quot; size=&quot;6&quot; id=&quot;js_year2&quot; name=&quot;js_year2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u67082(1\uff5e12): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_month2&quot; name=&quot;js_month2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u65e52(1\uff5e31): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_date2&quot; name=&quot;js_date2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u66422(0\uff5e23): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_hour2&quot; name=&quot;js_hour2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u52062(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_minute2&quot; name=&quot;js_minute2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t\t\u79d22(0\uff5e59): &lt;input type=&quot;text&quot; size=&quot;3&quot; id=&quot;js_second2&quot; name=&quot;js_second2&quot; \/&gt;&lt;br \/&gt;\r\n\t\t&lt;\/p&gt;\r\n\t\t&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;\u5165\u529b\u5b8c\u4e86&quot; onclick=&quot;output()&quot; \/&gt; &lt;input type=&quot;reset&quot; value=&quot;\u6d88\u53bb&quot; \/&gt;&lt;\/p&gt;\r\n\t\t&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\t\t\tdocument.getElementById(&#039;js_year1&#039;).value = now_year;\r\n\t\t\tdocument.getElementById(&#039;js_month1&#039;).value = now_month;\r\n\t\t\tdocument.getElementById(&#039;js_date1&#039;).value = now_date;\r\n\t\t\tdocument.getElementById(&#039;js_hour1&#039;).value = now_hour;\r\n\t\t\tdocument.getElementById(&#039;js_minute1&#039;).value = now_minute;\r\n\t\t\tdocument.getElementById(&#039;js_second1&#039;).value = now_second;\r\n\r\n\t\t\tdocument.getElementById(&#039;js_year2&#039;).value = now_year;\r\n\t\t\tdocument.getElementById(&#039;js_month2&#039;).value = now_month;\r\n\t\t\tdocument.getElementById(&#039;js_date2&#039;).value = now_date;\r\n\t\t\tdocument.getElementById(&#039;js_hour2&#039;).value = now_hour;\r\n\t\t\tdocument.getElementById(&#039;js_minute2&#039;).value = now_minute;\r\n\t\t\tdocument.getElementById(&#039;js_second2&#039;).value = now_second;\r\n\t\t&lt;\/script&gt;\r\n\t&lt;\/form&gt;\r\n\t&lt;p id=&quot;js_output_area&quot;&gt;&lt;\/p&gt;\r\n\t&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\t\t\tfunction output() {\r\n\t\t\t\tvar date1 = new Date( document.getElementById(&#039;js_year1&#039;).value + &#039;-&#039; + document.getElementById(&#039;js_month1&#039;).value + &#039;-&#039; + document.getElementById(&#039;js_date1&#039;).value + &#039; &#039; + document.getElementById(&#039;js_hour1&#039;).value + &#039;:&#039; + document.getElementById(&#039;js_minute1&#039;).value + &#039;:&#039; + document.getElementById(&#039;js_second1&#039;).value );\r\n\t\t\t\tvar date2 = new Date( document.getElementById(&#039;js_year2&#039;).value + &#039;-&#039; + document.getElementById(&#039;js_month2&#039;).value + &#039;-&#039; + document.getElementById(&#039;js_date2&#039;).value + &#039; &#039; + document.getElementById(&#039;js_hour2&#039;).value + &#039;:&#039; + document.getElementById(&#039;js_minute2&#039;).value + &#039;:&#039; + document.getElementById(&#039;js_second2&#039;).value );\r\n\t\t\t\tvar diff = new Date(date1 - date2);\r\n\r\n\t\t\t\tdocument.getElementById(&#039;js_output_area&#039;).innerHTML  = &#039;&lt;h3&gt;\u51fa\u529b&lt;\/h3&gt;\\n&#039;;\r\n\t\t\t\tdocument.getElementById(&#039;js_output_area&#039;).innerHTML +=  &#039;Date1: &#039; + date1.getFullYear() + &#039;-&#039; + (date1.getMonth() + 1) + &#039;-&#039; + date1.getDate() + &#039; &#039; + date1.getHours() + &#039;:&#039; + date1.getMinutes() + &#039;:&#039; + date1.getSeconds() + &#039;&lt;br \/&gt;\\n&#039;;\r\n\t\t\t\tdocument.getElementById(&#039;js_output_area&#039;).innerHTML +=  &#039;Date2: &#039; + date2.getFullYear() + &#039;-&#039; + (date2.getMonth() + 1) + &#039;-&#039; + date2.getDate() + &#039; &#039; + date2.getHours() + &#039;:&#039; + date2.getMinutes() + &#039;:&#039; + date2.getSeconds() + &#039;&lt;br \/&gt;\\n&#039;;\r\n\t\t\t\tdocument.getElementById(&#039;js_output_area&#039;).innerHTML +=  &#039;Date1 - Date2: &#039; + (diff.getUTCFullYear() - 1970) + &#039;-&#039; + diff.getUTCMonth() + &#039;-&#039; + (diff.getDate() - 1) + &#039; &#039; + diff.getUTCHours() + &#039;:&#039; + diff.getUTCMinutes() + &#039;:&#039; + diff.getUTCSeconds() + &#039;&lt;br \/&gt;\\n&#039;;\r\n\t\t\t\r\n\t\t\t}\r\n\t&lt;\/script&gt;\r\n&lt;\/div&gt;\r\n&lt;\/p&gt;\r\n&lt;!-- float\u30af\u30ea\u30a2 --&gt;\r\n&lt;p style=&quot;clear: both;&quot;&gt;\r\n&lt;h2&gt;\u53c2\u8003 URL&lt;\/h2&gt;\r\n\t&lt;ul&gt;\r\n\t\t&lt;li&gt;&lt;a href=&quot;http:\/\/qiita.com\/re-24\/items\/c3ed814f2e1ee0f8e811#%E6%97%A5%E4%BB%98%E3%81%AE%E5%B7%AE%E3%82%92%E8%A8%88%E7%AE%97&quot;&gt;Qiita: DataTime\u30af\u30e9\u30b9\u306e\u307e\u3068\u3081\u30e1\u30e2&lt;\/a&gt;&lt;\/li&gt;\r\n\t\t&lt;li&gt;&lt;a href=&quot;http:\/\/qiita.com\/kazu56\/items\/cca24cfdca4553269cab&quot;&gt;Qiita: \u3010Javascript\u3011\u65e5\u4ed8\u51e6\u7406&lt;\/a&gt;&lt;\/li&gt;\r\n\t&lt;\/ul&gt;\r\n&lt;\/p&gt;\r\n&lt;hr \/&gt;\r\n&lt;address&gt;Tomonori Kouya : Copyright (c) 2016 All rights reserved.&lt;\/address&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u9577\u6642\u9593\u306b\u308f\u305f\u308b\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30c6\u30b9\u30c8\u306e\u958b\u59cb\u65e5\u6642\u3068\u7d42\u4e86\u65e5\u6642\u306e\u5dee\u3092\u5c0e\u51fa\u3059\u308b\u5fc5\u8981\u306b\u8feb\u3089\u308c\u305f\u306e\u3067\uff0cPHP\u3068JavaScript\u3067\u305d\u308c\u305e\u308c\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002 http:\/\/cs-tklab.na-inet.jp\/~tkouya\/di &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/kd-tklab.na-inet.jp\/?p=1070\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;[\u5352\u7814\u30e1\u30e2] PHP\u3068JavaScript\u306b\u3088\u308b\u65e5\u4ed8\u5dee\u306e\u8a08\u7b97&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[5],"tags":[],"class_list":["post-1070","post","type-post","status-publish","format-standard","hentry","category-5"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6Oxer-hg","jetpack-related-posts":[{"id":245,"url":"https:\/\/kd-tklab.na-inet.jp\/?p=245","url_meta":{"origin":1070,"position":0},"title":"\u5352\u7814\u30e1\u30e2: MathJAX\u30b5\u30f3\u30d7\u30eb, JavaScript\u30b5\u30f3\u30d7\u30eb","author":"T.Kouya","date":"2015\u5e744\u670830\u65e5","format":false,"excerpt":"\u66f4\u65b0\u304c\u306a\u3044\u306e\u3082\u5bc2\u3057\u3044\u306e\u3067\uff0c\u8efd\u3081\u306e\u30e1\u30e2\u3092\u66f8\u304f\u3053\u3068\u306b\u3002\u5352\u7814\u3067\u5f79\u7acb\u3061\u305d\u3046\u306a\u3082\u306e\u306e\u30ea\u30f3\u30af\u3092\u5f35\u308a\u4ed8\u3051\u3066\u304a\u304f\u3002 \u2026","rel":"","context":"\u5352\u7814\u30e1\u30e2","block_context":{"text":"\u5352\u7814\u30e1\u30e2","link":"https:\/\/kd-tklab.na-inet.jp\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":893,"url":"https:\/\/kd-tklab.na-inet.jp\/?p=893","url_meta":{"origin":1070,"position":1},"title":"\u5352\u7814\u30e1\u30e2\uff1aPHP + MySQL\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u6559\u6750\u5b8c\u6210","author":"T.Kouya","date":"2016\u5e745\u67082\u65e5","format":false,"excerpt":"\u30002014\u5e74\u5ea6\u306e\u5352\u696d\u7814\u7a76\u3068\u3057\u3066\u5236\u4f5c\u3057\u3066\u304f\u308c\u305fPHP+MySQL\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u6559\u6750\u3067\u3059\u304c\u3001\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u2026","rel":"","context":"\u5352\u7814\u30e1\u30e2","block_context":{"text":"\u5352\u7814\u30e1\u30e2","link":"https:\/\/kd-tklab.na-inet.jp\/?cat=5"},"img":{"alt_text":"2016-05-02_220046","src":"https:\/\/i0.wp.com\/cs-tklab.na-inet.jp\/blog\/wp-content\/uploads\/2016\/05\/2016-05-02_220046-300x227.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1356,"url":"https:\/\/kd-tklab.na-inet.jp\/?p=1356","url_meta":{"origin":1070,"position":2},"title":"\u5352\u7814\u30e1\u30e2: FullCalendar\u5229\u7528\u65b9\u6cd5","author":"T.Kouya","date":"2017\u5e745\u670824\u65e5","format":false,"excerpt":"\u3000\u5352\u7814\u3067jQuery\u30d5\u30a1\u30df\u30ea\u30fc\u306eJavaScript\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308bFullCalendar\u3092\u5229\u7528\u3059\u2026","rel":"","context":"\u5352\u7814\u30e1\u30e2","block_context":{"text":"\u5352\u7814\u30e1\u30e2","link":"https:\/\/kd-tklab.na-inet.jp\/?cat=5"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cs-tklab.na-inet.jp\/blog\/wp-content\/uploads\/2017\/05\/contents_table-300x112.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":796,"url":"https:\/\/kd-tklab.na-inet.jp\/?p=796","url_meta":{"origin":1070,"position":3},"title":"\u5352\u7814\u30e1\u30e2\uff1a w3schools.com","author":"T.Kouya","date":"2016\u5e742\u670819\u65e5","format":false,"excerpt":"\u30ce\u30eb\u30a6\u30a7\u30fc\u306e\u4f1a\u793e\u304c1998\u5e74\u4ee5\u6765\u4f5c\u308a\u7d9a\u3051\u3066\u3044\u308bWeb\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u96c6\u3067\u3059\u3002HTML, JavaScr\u2026","rel":"","context":"\u5352\u7814\u30e1\u30e2","block_context":{"text":"\u5352\u7814\u30e1\u30e2","link":"https:\/\/kd-tklab.na-inet.jp\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":767,"url":"https:\/\/kd-tklab.na-inet.jp\/?p=767","url_meta":{"origin":1070,"position":4},"title":"\u5352\u7814\u30e1\u30e2: Waterloo\u5927\u5b66\u306eWeb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u6559\u6750","author":"T.Kouya","date":"2016\u5e742\u67089\u65e5","format":false,"excerpt":"\u3000\u30ab\u30ca\u30c0\u306eWaterloo\u5927\u5b66\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308bWeb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u6559\u6750\u306e\u51fa\u6765\u304c\u3044\u3044\u306e\u3067\u7d39\u4ecb\u3057\u3066\u304a\u304d\u307e\u3059\u2026","rel":"","context":"\u5352\u7814\u30e1\u30e2","block_context":{"text":"\u5352\u7814\u30e1\u30e2","link":"https:\/\/kd-tklab.na-inet.jp\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1383,"url":"https:\/\/kd-tklab.na-inet.jp\/?p=1383","url_meta":{"origin":1070,"position":5},"title":"\u5352\u7814\u30e1\u30e2: UTF-8N\u3067\u4fdd\u5b58\uff01","author":"T.Kouya","date":"2017\u5e745\u670831\u65e5","format":false,"excerpt":"\u3000\u53e4\u3044\u30a8\u30c7\u30a3\u30bf\uff08TeraPad\u306a\u3069\uff09\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\uff0c\u6587\u5b57\u30b3\u30fc\u30c9\u3092UTF-8\u306b\u3057\u3066\u4fdd\u5b58\u3057\u305fPHP\u30b9\u30af\u30ea\u2026","rel":"","context":"\u5352\u7814\u30e1\u30e2","block_context":{"text":"\u5352\u7814\u30e1\u30e2","link":"https:\/\/kd-tklab.na-inet.jp\/?cat=5"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"amp_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=\/wp\/v2\/posts\/1070","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1070"}],"version-history":[{"count":7,"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=\/wp\/v2\/posts\/1070\/revisions"}],"predecessor-version":[{"id":1078,"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=\/wp\/v2\/posts\/1070\/revisions\/1078"}],"wp:attachment":[{"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kd-tklab.na-inet.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}