{"id":302,"date":"2025-11-29T09:25:49","date_gmt":"2025-11-29T01:25:49","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=302"},"modified":"2025-11-29T09:25:49","modified_gmt":"2025-11-29T01:25:49","slug":"js%e4%b8%ad%e3%80%90data%e3%80%91%e8%af%a6%e8%a7%a3_js-date","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/11\/29\/js%e4%b8%ad%e3%80%90data%e3%80%91%e8%af%a6%e8%a7%a3_js-date\/","title":{"rendered":"JS\u4e2d\u3010Data\u3011\u8be6\u89e3_js date"},"content":{"rendered":"\n<p>\u597d\u7684\uff0c\u6211\u5e2e\u4f60\u6574\u7406\u4e00\u4efd <strong>JavaScript \u4e2d <code>Date<\/code> \u5bf9\u8c61\uff08JS \u4e2d\u7684\u65f6\u95f4\u4e0e\u65e5\u671f\u5904\u7406\uff09\u8be6\u89e3<\/strong>\uff0c\u4ece\u57fa\u7840\u5230\u9ad8\u7ea7\u65b9\u6cd5\uff0c\u8986\u76d6\u5e38\u7528\u7528\u6cd5\u3001\u5b9e\u4f8b\u548c\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e00\u3001Date \u5bf9\u8c61\u6982\u5ff5<\/strong><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Date<\/code> \u662f JavaScript \u5185\u7f6e\u5bf9\u8c61\uff0c\u7528\u6765\u5904\u7406 <strong>\u65e5\u671f\u548c\u65f6\u95f4<\/strong><\/li>\n\n\n\n<li>\u5185\u90e8\u4ee5 <strong>\u6beb\u79d2\u65f6\u95f4\u6233<\/strong>\uff081970-01-01 00:00:00 UTC \u8d77\u7684\u6beb\u79d2\u6570\uff09\u5b58\u50a8<\/li>\n\n\n\n<li>\u652f\u6301\u521b\u5efa\u3001\u683c\u5f0f\u5316\u3001\u6bd4\u8f83\u3001\u8fd0\u7b97<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u521b\u5efa Date \u5bf9\u8c61<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u5f53\u524d\u65f6\u95f4<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet now = new Date();\nconsole.log(now); \/\/ \u4f8b\u5982\uff1a2025-11-29T08:15:00.000Z\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u6307\u5b9a\u65e5\u671f\u5b57\u7b26\u4e32<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet d1 = new Date(&quot;2025-12-01T10:30:00&quot;);\nlet d2 = new Date(&quot;2025\/12\/01 10:30:00&quot;); \/\/ \u63a8\u8350 YYYY\/MM\/DD \u683c\u5f0f\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>3. \u6307\u5b9a\u5e74\u6708\u65e5\uff08\u6570\u5b57\u5f62\u5f0f\uff09<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/ new Date(year, monthIndex, day, hours, minutes, seconds, ms)\n\/\/ monthIndex \u4ece 0 \u5f00\u59cb\uff080 = \u4e00\u6708, 11 = \u5341\u4e8c\u6708\uff09\nlet d3 = new Date(2025, 11, 1, 10, 30, 0);\nconsole.log(d3); \/\/ 2025-12-01T10:30:00.000Z\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>4. \u4f7f\u7528\u65f6\u95f4\u6233<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet timestamp = Date.now(); \/\/ \u5f53\u524d\u65f6\u95f4\u6233\uff08\u6beb\u79d2\uff09\nlet d4 = new Date(timestamp);\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>\u4e09\u3001Date \u5e38\u7528\u65b9\u6cd5<\/strong><\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">1. <strong>\u83b7\u53d6\u65f6\u95f4\u4fe1\u606f<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u65b9\u6cd5<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td><code>getFullYear()<\/code><\/td><td>\u83b7\u53d6\u5e74\u4efd\uff08\u56db\u4f4d\uff09<\/td><\/tr><tr><td><code>getMonth()<\/code><\/td><td>\u83b7\u53d6\u6708\u4efd\uff080~11\uff09<\/td><\/tr><tr><td><code>getDate()<\/code><\/td><td>\u83b7\u53d6\u65e5\u671f\uff081~31\uff09<\/td><\/tr><tr><td><code>getDay()<\/code><\/td><td>\u83b7\u53d6\u661f\u671f\u51e0\uff080=\u5468\u65e5, 6=\u5468\u516d\uff09<\/td><\/tr><tr><td><code>getHours()<\/code><\/td><td>\u83b7\u53d6\u5c0f\u65f6\uff080~23\uff09<\/td><\/tr><tr><td><code>getMinutes()<\/code><\/td><td>\u83b7\u53d6\u5206\u949f\uff080~59\uff09<\/td><\/tr><tr><td><code>getSeconds()<\/code><\/td><td>\u83b7\u53d6\u79d2\uff080~59\uff09<\/td><\/tr><tr><td><code>getMilliseconds()<\/code><\/td><td>\u83b7\u53d6\u6beb\u79d2\uff080~999\uff09<\/td><\/tr><tr><td><code>getTime()<\/code><\/td><td>\u83b7\u53d6\u65f6\u95f4\u6233\uff08\u6beb\u79d2\uff09<\/td><\/tr><tr><td><code>getTimezoneOffset()<\/code><\/td><td>\u83b7\u53d6\u672c\u5730\u65f6\u533a\u4e0e UTC \u7684\u5dee\u503c\uff08\u5206\u949f\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet now = new Date();\nconsole.log(now.getFullYear()); \/\/ 2025\nconsole.log(now.getMonth());    \/\/ 10 (11\u6708)\nconsole.log(now.getDate());     \/\/ 29\nconsole.log(now.getDay());      \/\/ 6 (\u5468\u516d)\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. <strong>\u8bbe\u7f6e\u65f6\u95f4<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u65b9\u6cd5<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td><code>setFullYear(year)<\/code><\/td><td>\u8bbe\u7f6e\u5e74\u4efd<\/td><\/tr><tr><td><code>setMonth(month)<\/code><\/td><td>\u8bbe\u7f6e\u6708\u4efd\uff080~11\uff09<\/td><\/tr><tr><td><code>setDate(day)<\/code><\/td><td>\u8bbe\u7f6e\u65e5\u671f<\/td><\/tr><tr><td><code>setHours(hour)<\/code><\/td><td>\u8bbe\u7f6e\u5c0f\u65f6<\/td><\/tr><tr><td><code>setMinutes(minute)<\/code><\/td><td>\u8bbe\u7f6e\u5206\u949f<\/td><\/tr><tr><td><code>setSeconds(sec)<\/code><\/td><td>\u8bbe\u7f6e\u79d2<\/td><\/tr><tr><td><code>setMilliseconds(ms)<\/code><\/td><td>\u8bbe\u7f6e\u6beb\u79d2<\/td><\/tr><tr><td><code>setTime(ms)<\/code><\/td><td>\u8bbe\u7f6e\u65f6\u95f4\u6233<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet d = new Date();\nd.setFullYear(2026);\nd.setMonth(0); \/\/ \u4e00\u6708\nd.setDate(1);  \/\/ 1\u53f7\nconsole.log(d); \/\/ 2026-01-01T...\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. <strong>\u683c\u5f0f\u5316\u65e5\u671f<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u5185\u7f6e\u65b9\u6cd5<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet now = new Date();\nconsole.log(now.toString());       \/\/ Thu Nov 29 2025 16:15:00 GMT+0800 (CST)\nconsole.log(now.toUTCString());    \/\/ Thu, 29 Nov 2025 08:15:00 GMT\nconsole.log(now.toISOString());    \/\/ 2025-11-29T08:15:00.000Z\nconsole.log(now.toDateString());   \/\/ Thu Nov 29 2025\nconsole.log(now.toTimeString());   \/\/ 16:15:00 GMT+0800 (CST)\nconsole.log(now.toLocaleString()); \/\/ 2025\/11\/29 16:15:00 (\u672c\u5730\u683c\u5f0f)\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u81ea\u5b9a\u4e49\u683c\u5f0f<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet d = new Date();\nlet formatted = `${d.getFullYear()}-${d.getMonth()+1}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}`;\nconsole.log(formatted); \/\/ 2025-11-29 16:15:0\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. <strong>\u65e5\u671f\u8fd0\u7b97<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. \u52a0\u51cf\u5929\u6570<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet today = new Date();\nlet tomorrow = new Date(today.getTime() + 24*60*60*1000); \/\/ \u52a0\u4e00\u5929\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>2. \u4e24\u4e2a\u65e5\u671f\u5dee\u503c<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet d1 = new Date(&quot;2025-12-01&quot;);\nlet d2 = new Date(&quot;2025-11-29&quot;);\nlet diffDays = (d1 - d2) \/ (1000*60*60*24); \/\/ \u5dee\u503c\u5929\u6570\nconsole.log(diffDays); \/\/ 2\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. <strong>\u5e38\u7528\u6280\u5de7<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u83b7\u53d6\u65f6\u95f4\u6233\uff08\u6beb\u79d2\uff09<\/strong><\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet timestamp = Date.now();\n\n<\/pre><\/div>\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u751f\u6210\u5f53\u524d\u65e5\u671f\u7684 YYYY-MM-DD<\/strong><\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction getTodayStr(){\n    let d = new Date();\n    return `${d.getFullYear()}-${d.getMonth()+1}-${d.getDate()}`;\n}\n\n<\/pre><\/div>\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u5224\u65ad\u95f0\u5e74<\/strong><\/li>\n<\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction isLeapYear(year){\n    return (year%4===0 &amp;amp;&amp;amp; year%100!==0) || (year%400===0);\n}\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6. <strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6708\u4efd\u4ece 0 \u5f00\u59cb<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>0 = 1\u6708<\/code>, <code>11 = 12\u6708<\/code><\/li>\n\n\n\n<li>\u5e38\u89c1 bug: <code>new Date(2025, 11, 1)<\/code> \u2192 12\u67081\u65e5<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Date \u5b57\u7b26\u4e32\u89e3\u6790\u517c\u5bb9\u6027<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>\"YYYY-MM-DD\"<\/code> \u5728\u90e8\u5206\u6d4f\u89c8\u5668\u53ef\u80fd\u88ab\u89e3\u6790\u4e3a UTC<\/li>\n\n\n\n<li>\u63a8\u8350 <code>\"YYYY\/MM\/DD\"<\/code> \u6216 <code>\"YYYY-MM-DDTHH:mm:ss\"<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u65f6\u533a\u95ee\u9898<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>getHours()<\/code> \u8fd4\u56de\u672c\u5730\u65f6\u95f4<\/li>\n\n\n\n<li><code>getUTCHours()<\/code> \u8fd4\u56de UTC \u65f6\u95f4<\/li>\n\n\n\n<li>\u6ce8\u610f\u8de8\u65f6\u533a\u8fd0\u7b97<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e03\u3001\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u521b\u5efa\u65e5\u671f<\/strong>\uff1a<code>new Date()<\/code> \/ \u65f6\u95f4\u6233 \/ \u5b57\u7b26\u4e32<\/li>\n\n\n\n<li><strong>\u83b7\u53d6\/\u8bbe\u7f6e\u65f6\u95f4<\/strong>\uff1a<code>getFullYear()<\/code> \/ <code>setDate()<\/code> \u7b49<\/li>\n\n\n\n<li><strong>\u683c\u5f0f\u5316<\/strong>\uff1a\u5185\u7f6e <code>toISOString()<\/code> \u6216\u81ea\u5b9a\u4e49\u62fc\u63a5<\/li>\n\n\n\n<li><strong>\u65e5\u671f\u8fd0\u7b97<\/strong>\uff1a\u6beb\u79d2 + \u65f6\u95f4\u5dee = \u5929\u6570 \/ \u5c0f\u65f6 \/ \u5206\u949f<\/li>\n\n\n\n<li><strong>\u6ce8\u610f\u4e8b\u9879<\/strong>\uff1a\u6708\u4efd\u4ece 0 \u5f00\u59cb\uff0c\u65f6\u533a\u5dee\u5f02\uff0c\u5b57\u7b26\u4e32\u89e3\u6790\u517c\u5bb9\u6027<\/li>\n<\/ul>\n\n\n\n<p>\u597d\u561e\uff0c\u6211\u7ed9\u4f60\u505a\u4e00\u5f20 <strong>JavaScript Date \u4f7f\u7528\u901f\u67e5\u8868 + \u53ef\u89c6\u5316\u6d41\u7a0b\u56fe<\/strong>\uff0c\u628a\u521b\u5efa\u3001\u83b7\u53d6\u3001\u8bbe\u7f6e\u3001\u683c\u5f0f\u5316\u3001\u65e5\u671f\u8fd0\u7b97\u5168\u90fd\u68b3\u7406\u6e05\u695a\uff0c\u4e00\u773c\u5c31\u80fd\u770b\u61c2\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nflowchart TD\n    A&#x5B;Date \u5bf9\u8c61] --&gt; B&#x5B;\u521b\u5efa Date]\n    B --&gt; B1&#x5B;new Date()] \n    B --&gt; B2&#x5B;new Date(timestamp)]\n    B --&gt; B3&#x5B;new Date(&quot;YYYY-MM-DD HH:MM:SS&quot;)]\n    B --&gt; B4&#x5B;new Date(year, monthIndex, day, ...)]\n\n    A --&gt; C&#x5B;\u83b7\u53d6\u65f6\u95f4\u4fe1\u606f]\n    C --&gt; C1&#x5B;getFullYear()]\n    C --&gt; C2&#x5B;getMonth()]\n    C --&gt; C3&#x5B;getDate()]\n    C --&gt; C4&#x5B;getDay()]\n    C --&gt; C5&#x5B;getHours()]\n    C --&gt; C6&#x5B;getMinutes()]\n    C --&gt; C7&#x5B;getSeconds()]\n    C --&gt; C8&#x5B;getMilliseconds()]\n    C --&gt; C9&#x5B;getTime()]\n    C --&gt; C10&#x5B;getTimezoneOffset()]\n\n    A --&gt; D&#x5B;\u8bbe\u7f6e\u65f6\u95f4]\n    D --&gt; D1&#x5B;setFullYear(year)]\n    D --&gt; D2&#x5B;setMonth(month)]\n    D --&gt; D3&#x5B;setDate(day)]\n    D --&gt; D4&#x5B;setHours(hour)]\n    D --&gt; D5&#x5B;setMinutes(minute)]\n    D --&gt; D6&#x5B;setSeconds(sec)]\n    D --&gt; D7&#x5B;setMilliseconds(ms)]\n    D --&gt; D8&#x5B;setTime(ms)]\n\n    A --&gt; E&#x5B;\u683c\u5f0f\u5316\u65e5\u671f]\n    E --&gt; E1&#x5B;toString()]\n    E --&gt; E2&#x5B;toUTCString()]\n    E --&gt; E3&#x5B;toISOString()]\n    E --&gt; E4&#x5B;toDateString()]\n    E --&gt; E5&#x5B;toTimeString()]\n    E --&gt; E6&#x5B;toLocaleString()]\n    E --&gt; E7&#x5B;\u81ea\u5b9a\u4e49\u62fc\u63a5 `${year}-${month}-${day}`]\n\n    A --&gt; F&#x5B;\u65e5\u671f\u8fd0\u7b97]\n    F --&gt; F1&#x5B;\u52a0\u51cf\u5929\u6570: getTime() + 24*60*60*1000]\n    F --&gt; F2&#x5B;\u65e5\u671f\u5dee\u503c: (d1 - d2) \/ (1000*60*60*24)]\n\n    A --&gt; G&#x5B;\u5e38\u7528\u6280\u5de7]\n    G --&gt; G1&#x5B;\u83b7\u53d6\u65f6\u95f4\u6233: Date.now()]\n    G --&gt; G2&#x5B;\u5224\u65ad\u95f0\u5e74: isLeapYear(year)]\n    G --&gt; G3&#x5B;\u6ce8\u610f\u6708\u4efd\u4ece0\u5f00\u59cb]\n    G --&gt; G4&#x5B;\u65f6\u533a\u95ee\u9898: getHours() vs getUTCHours()]\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u901f\u67e5\u8868\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u64cd\u4f5c\u7c7b\u578b<\/th><th>\u65b9\u6cd5\/\u793a\u4f8b<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td>\u521b\u5efa Date<\/td><td><code>new Date()<\/code> \/ <code>new Date(2025,11,1)<\/code><\/td><td>\u5f53\u524d\u65f6\u95f4 \/ \u65f6\u95f4\u6233 \/ \u5e74\u6708\u65e5<\/td><\/tr><tr><td>\u83b7\u53d6\u4fe1\u606f<\/td><td><code>getFullYear()<\/code>, <code>getMonth()<\/code>, <code>getDate()<\/code>\u2026<\/td><td>\u83b7\u53d6\u5e74\u4efd\u3001\u6708\u4efd\u3001\u65e5\u3001\u5c0f\u65f6\u3001\u5206\u949f\u7b49<\/td><\/tr><tr><td>\u8bbe\u7f6e\u65f6\u95f4<\/td><td><code>setFullYear(2026)<\/code> \/ <code>setDate(15)<\/code><\/td><td>\u4fee\u6539\u5e74\u3001\u6708\u3001\u65e5\u3001\u65f6\u3001\u5206\u3001\u79d2<\/td><\/tr><tr><td>\u683c\u5f0f\u5316<\/td><td><code>toISOString()<\/code>, <code>toLocaleString()<\/code>, \u81ea\u5b9a\u4e49<\/td><td>ISO \/ \u672c\u5730 \/ \u81ea\u5b9a\u4e49\u683c\u5f0f<\/td><\/tr><tr><td>\u65e5\u671f\u8fd0\u7b97<\/td><td><code>(d1 - d2)\/1000\/60\/60\/24<\/code><\/td><td>\u8ba1\u7b97\u5929\u6570\u5dee \/ \u52a0\u51cf\u65f6\u95f4<\/td><\/tr><tr><td>\u5c0f\u6280\u5de7<\/td><td><code>Date.now()<\/code>, <code>isLeapYear(year)<\/code><\/td><td>\u83b7\u53d6\u65f6\u95f4\u6233\u3001\u5224\u65ad\u95f0\u5e74\u7b49<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u7684\uff0c\u6211\u5e2e\u4f60\u6574\u7406\u4e00\u4efd JavaScript \u4e2d Date \u5bf9\u8c61\uff08JS \u4e2d\u7684\u65f6\u95f4\u4e0e&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/11\/29\/js%e4%b8%ad%e3%80%90data%e3%80%91%e8%af%a6%e8%a7%a3_js-date\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-302","post","type-post","status-publish","format-standard","hentry","category-12"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=302"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/302\/revisions"}],"predecessor-version":[{"id":303,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/302\/revisions\/303"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}