{"id":180923,"date":"2024-05-08T20:45:23","date_gmt":"2024-05-08T12:45:23","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/180923.html"},"modified":"2024-05-08T20:45:30","modified_gmt":"2024-05-08T12:45:30","slug":"r%e8%af%ad%e8%a8%80%e4%b8%adstrptime%e5%87%bd%e6%95%b0%e6%98%af%e6%80%8e%e4%b9%88%e4%bd%bf%e7%94%a8%e7%9a%84","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/180923.html","title":{"rendered":"R\u8bed\u8a00\u4e2dstrptime\u51fd\u6570\u662f\u600e\u4e48\u4f7f\u7528\u7684"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27070301\/28a1680e-266c-4f83-925b-5d52f6b592b7.webp\" alt=\"R\u8bed\u8a00\u4e2dstrptime\u51fd\u6570\u662f\u600e\u4e48\u4f7f\u7528\u7684\" \/><\/p>\n<p><p>strptime\u51fd\u6570\u5728R\u8bed\u8a00\u4e2d\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u65f6\u95f4\u6570\u636e\u8f6c\u6362\u4e3a\u65e5\u671f\u65f6\u95f4\uff08Date-Time\uff09\u5bf9\u8c61\u3002<strong>\u8be5\u51fd\u6570\u5141\u8bb8\u7528\u6237\u8bbe\u5b9a\u65f6\u95f4\u7684\u683c\u5f0f\u3001\u8bfb\u53d6\u4e0d\u540c\u8bed\u8a00\u7684\u6708\u4efd\u548c\u661f\u671f\u540d\u79f0\uff0c\u5e76\u5904\u7406\u5404\u79cd\u65f6\u95f4\u548c\u65e5\u671f\u683c\u5f0f\u3002<\/strong><\/p>\n<\/p>\n<p><p>strptime\u51fd\u6570\u7684\u57fa\u672c\u4f7f\u7528\u65b9\u6cd5\u6d89\u53ca\u63d0\u4f9b\u8981\u8f6c\u6362\u7684\u65f6\u95f4\u5b57\u7b26\u4e32\u548c\u9884\u671f\u7684\u683c\u5f0f\u5b57\u7b26\u4e32\u3002\u683c\u5f0f\u5b57\u7b26\u4e32\u4f7f\u7528\u7279\u5b9a\u7684\u7b26\u53f7\u8868\u793a\u4e0d\u540c\u7684\u65f6\u95f4\u6210\u5206\uff0c\u5982%Y\u4ee3\u8868\u56db\u4f4d\u6570\u7684\u5e74\u4efd\u3001%m\u4ee3\u8868\u6708\u4efd\u3001%d\u4ee3\u8868\u4e00\u4e2a\u6708\u4e2d\u7684\u65e5\u6570\u3001%H\u4ee3\u8868\u5c0f\u65f6\u7b49\u3002\u4f7f\u7528strptime\u51fd\u6570\uff0c\u53ef\u4ee5\u786e\u4fdd\u65e5\u671f\u65f6\u95f4\u6570\u636e\u88ab\u6b63\u786e\u89e3\u6790\u548c\u5904\u7406\uff0c\u4ece\u800c\u9002\u914dR\u8bed\u8a00\u4e2d\u65e5\u671f\u65f6\u95f4\u76f8\u5173\u7684\u51fd\u6570\u548c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001STRPTIME\u51fd\u6570\u7684\u57fa\u672c\u4f7f\u7528<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528strptime\u51fd\u6570\u65f6\uff0c\u5fc5\u987b\u81f3\u5c11\u63d0\u4f9b\u4e24\u4e2a\u53c2\u6570\uff1a\u65f6\u95f4\u5b57\u7b26\u4e32\u548c\u683c\u5f0f\u5b57\u7b26\u4e32\u3002\u8fd9\u4e24\u4e2a\u53c2\u6570\u5206\u522b\u6307\u660e\u4e86\u8981\u8f6c\u6362\u7684\u539f\u59cb\u6570\u636e\u548c\u8be5\u6570\u636e\u9075\u5faa\u7684\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><h4>\u51fd\u6570\u683c\u5f0f<\/h4>\n<\/p>\n<p><pre><code class=\"language-R\">strptime(time, format, tz = &quot;&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u53c2\u6570\u89e3\u91ca<\/h4>\n<\/p>\n<ul>\n<li><code>time<\/code>: \u4ee3\u8868\u8f93\u5165\u7684\u65f6\u95f4\u5b57\u7b26\u4e32\u3002<\/li>\n<li><code>format<\/code>: \u63cf\u8ff0\u65f6\u95f4\u6570\u636e\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7279\u6b8a\u7684\u683c\u5f0f\u4ee3\u7801\u3002<\/li>\n<li><code>tz<\/code>: \u53ef\u9009\u53c2\u6570\uff0c\u7528\u6765\u6307\u5b9a\u65f6\u533a\u3002<\/li>\n<\/ul>\n<p><h4>\u793a\u4f8b<\/h4>\n<\/p>\n<p><pre><code class=\"language-R\">date_time_str &lt;- &quot;2021-12-31 23:59:59&quot;<\/p>\n<p>date_time_obj &lt;- strptime(date_time_str, format = &quot;%Y-%m-%d %H:%M:%S&quot;)<\/p>\n<p>print(date_time_obj)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u9996\u5148\u8bbe\u5b9a\u4e86\u4e00\u4e2a\u65f6\u95f4\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u4f7f\u7528strptime\u51fd\u6570\u6309\u7167\u5e74-\u6708-\u65e5 \u65f6:\u5206:\u79d2\u7684\u683c\u5f0f\u8fdb\u884c\u8f6c\u6362\uff0c\u6700\u540e\u6253\u5370\u51fa\u8f6c\u6362\u540e\u7684\u65e5\u671f\u65f6\u95f4\u5bf9\u8c61\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u65f6\u95f4\u683c\u5f0f\u7b26\u53f7\u7684\u5e94\u7528<\/h3>\n<\/p>\n<p><p>\u5728strptime\u51fd\u6570\u4e2d\uff0c\u5404\u79cd\u683c\u5f0f\u7b26\u53f7\u7528\u4e8e\u4ee3\u8868\u65f6\u95f4\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u90e8\u5206\uff0c\u8fd9\u662f\u8fdb\u884c\u65f6\u95f4\u89e3\u6790\u7684\u5173\u952e\u3002<\/p>\n<\/p>\n<p><h4>\u5e38\u7528\u683c\u5f0f\u7b26\u53f7<\/h4>\n<\/p>\n<ul>\n<li><code>%Y<\/code>\uff1a\u56db\u4f4d\u5e74\u4efd\u3002<\/li>\n<li><code>%m<\/code>\uff1a\u4e24\u4f4d\u6570\u6708\u4efd\u3002<\/li>\n<li><code>%d<\/code>\uff1a\u4e24\u4f4d\u6570\u5929\u6570\u3002<\/li>\n<li><code>%H<\/code>\uff1a\u5c0f\u65f6\u3002<\/li>\n<li><code>%M<\/code>\uff1a\u5206\u949f\u3002<\/li>\n<li><code>%S<\/code>\uff1a\u79d2\u3002<\/li>\n<\/ul>\n<p><p><strong>\u683c\u5f0f\u7b26\u53f7\u7684\u6b63\u786e\u5e94\u7528\u80fd\u591f\u4fdd\u8bc1\u65f6\u95f4\u5b57\u7b26\u4e32\u51c6\u786e\u65e0\u8bef\u5730\u88ab\u8f6c\u6362\u3002<\/strong><\/p>\n<\/p>\n<p><h4>\u793a\u4f8b<\/h4>\n<\/p>\n<p><pre><code class=\"language-R\">time_str &lt;- &quot;03\/15\/2021 1:45 PM&quot;<\/p>\n<p>time_obj &lt;- strptime(time_str, format = &quot;%m\/%d\/%Y %I:%M %p&quot;)<\/p>\n<p>print(time_obj)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528\u5e26\u670912\u5c0f\u65f6\u5236\u548cAM\/PM\u8868\u793a\u7684\u65f6\u95f4\u683c\u5f0f\uff0c\u5e76\u901a\u8fc7\u683c\u5f0f\u7b26\u53f7\u8fdb\u884c\u5339\u914d\u548c\u8f6c\u6362\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5904\u7406\u4e0d\u540c\u7684\u65f6\u95f4\u683c\u5f0f<\/h3>\n<\/p>\n<p><p>strptime\u51fd\u6570\u80fd\u591f\u5904\u7406\u591a\u79cd\u590d\u6742\u7684\u65f6\u95f4\u683c\u5f0f\uff0c\u8fd9\u4f7f\u5f97\u5b83\u5728\u6570\u636e\u6e05\u6d17\u548c\u51c6\u5907\u8fc7\u7a0b\u4e2d\u5c24\u5176\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h4>\u5904\u740624\u5c0f\u65f6\u5236\u548c12\u5c0f\u65f6\u5236<\/h4>\n<\/p>\n<p><p>\u6839\u636e\u65f6\u95f4\u7684\u8868\u73b0\u5f62\u5f0f\u4e0d\u540c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>%H<\/code>\u6765\u8868\u793a24\u5c0f\u65f6\u5236\u7684\u5c0f\u65f6\uff0c\u6216\u8005\u4f7f\u7528<code>%I<\/code>\u4e0e<code>%p<\/code>\u6765\u5171\u540c\u8868\u793a12\u5c0f\u65f6\u5236\u7684\u5c0f\u65f6\u548cAM\/PM\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b<\/h4>\n<\/p>\n<p><pre><code class=\"language-R\">time_str_24h &lt;- &quot;18:30:00&quot;<\/p>\n<p>time_str_12h &lt;- &quot;06:30:00 PM&quot;<\/p>\n<p>time_obj_24h &lt;- strptime(time_str_24h, format = &quot;%H:%M:%S&quot;)<\/p>\n<p>time_obj_12h &lt;- strptime(time_str_12h, format = &quot;%I:%M:%S %p&quot;)<\/p>\n<p>print(time_obj_24h)<\/p>\n<p>print(time_obj_12h)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u5bf9\u6bd4\uff0c\u53ef\u4ee5\u770b\u51fa\u5982\u4f55\u5904\u7406\u4e0d\u540c\u7684\u65f6\u95f4\u8868\u793a\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5904\u7406\u591a\u79cd\u8bed\u8a00\u548c\u533a\u57df\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p>\u5728\u5168\u7403\u5316\u7684\u6570\u636e\u5904\u7406\u9700\u6c42\u4e2d\uff0c\u5e38\u5e38\u9700\u8981\u89e3\u6790\u591a\u79cd\u8bed\u8a00\u7684\u6708\u4efd\u548c\u661f\u671f\u540d\u79f0\u3002strptime\u51fd\u6570\u652f\u6301\u591a\u8bed\u8a00\u73af\u5883\uff0c\u53ef\u4ee5\u901a\u8fc7\u5408\u9002\u7684\u533a\u57df\u8bbe\u7f6e\u6765\u5904\u7406\u8fd9\u4e9b\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h4>\u533a\u57df\u8bbe\u7f6e\u51fd\u6570<\/h4>\n<\/p>\n<p><p>R\u8bed\u8a00\u63d0\u4f9b\u4e86<code>Sys.setlocale()<\/code>\u51fd\u6570\u6765\u6539\u53d8R\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u5305\u62ec\u65f6\u95f4\u7684\u8bed\u8a00\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b<\/h4>\n<\/p>\n<p><pre><code class=\"language-R\">Sys.setlocale(&quot;LC_TIME&quot;, &quot;de_DE&quot;)<\/p>\n<p>time_str &lt;- &quot;31. Dezember 2021 23:59&quot;<\/p>\n<p>time_obj &lt;- strptime(time_str, format = &quot;%d. %B %Y %H:%M&quot;)<\/p>\n<p>print(time_obj)<\/p>\n<p>Sys.setlocale(&quot;LC_TIME&quot;, &quot;C&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5148\u5c06\u533a\u57df\u8bbe\u7f6e\u5207\u6362\u5230\u5fb7\u8bed\uff0c\u7136\u540e\u89e3\u6790\u4e00\u4e2a\u5fb7\u8bed\u683c\u5f0f\u7684\u65e5\u671f\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u65f6\u533a\u7684\u5904\u7406<\/h3>\n<\/p>\n<p><p>strptime\u51fd\u6570\u8fd8\u5141\u8bb8\u6307\u5b9a\u65f6\u533a\uff0c\u786e\u4fdd\u8de8\u65f6\u533a\u7684\u65f6\u95f4\u80fd\u591f\u51c6\u786e\u8868\u793a\u3002<\/p>\n<\/p>\n<p><h4>\u65f6\u533a\u53c2\u6570<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>tz<\/code>\u53c2\u6570\u8bbe\u7f6e\u65f6\u95f4\u7684\u65f6\u533a\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b<\/h4>\n<\/p>\n<p><pre><code class=\"language-R\">time_str &lt;- &quot;2021-12-31 23:59:59 PST&quot;<\/p>\n<p>time_obj &lt;- strptime(time_str, format = &quot;%Y-%m-%d %H:%M:%S&quot;, tz = &quot;PST&quot;)<\/p>\n<p>print(time_obj)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5c06\u5904\u4e8e\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4(PST)\u7684\u65f6\u95f4\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u65e5\u671f\u65f6\u95f4\u5bf9\u8c61\u3002<\/p>\n<\/p>\n<p><h3>\u7ed3\u8bba<\/h3>\n<\/p>\n<p><p><strong>strptime\u51fd\u6570\u662fR\u8bed\u8a00\u4e2d\u4e00\u4e2a\u5f3a\u5927\u800c\u7075\u6d3b\u7684\u5de5\u5177<\/strong>\uff0c\u5b83\u80fd\u591f\u5904\u7406\u591a\u79cd\u65f6\u95f4\u683c\u5f0f\uff0c\u9002\u5e94\u4e0d\u540c\u7684\u8bed\u8a00\u548c\u533a\u57df\u8bbe\u7f6e\uff0c\u5e76\u8003\u8651\u5230\u65f6\u533a\u95ee\u9898\u3002\u901a\u8fc7\u6709\u6548\u5730\u4f7f\u7528strptime\uff0c\u53ef\u4ee5\u5927\u5e45\u63d0\u5347\u5728\u6570\u636e\u5206\u6790\u8fc7\u7a0b\u4e2d\u5904\u7406\u65f6\u95f4\u6570\u636e\u7684\u6548\u7387\u548c\u51c6\u786e\u6027\u3002\u638c\u63e1strptime\u51fd\u6570\u7684\u5404\u9879\u529f\u80fd\uff0c\u5bf9\u4e8e\u4efb\u4f55\u4f7f\u7528R\u8bed\u8a00\u8fdb\u884c\u65f6\u95f4\u5e8f\u5217\u5206\u6790\u7684\u6570\u636e\u79d1\u5b66\u5bb6\u6765\u8bf4\uff0c\u90fd\u662f\u4e00\u9879\u5b9d\u8d35\u7684\u6280\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u6b63\u786e\u4f7f\u7528R\u8bed\u8a00\u4e2d\u7684strptime\u51fd\u6570\uff1f<\/strong><\/p>\n<p>R\u8bed\u8a00\u4e2d\u7684strptime\u51fd\u6570\u7528\u4e8e\u5c06\u5b57\u7b26\u5411\u91cf\u8f6c\u6362\u4e3a\u65e5\u671f\u6216\u65f6\u95f4\u683c\u5f0f\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u6765\u6b63\u786e\u4f7f\u7528\u8be5\u51fd\u6570\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u786e\u4fdd\u5c06\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u5411\u91cf\u4f5c\u4e3astrptime\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4f20\u5165\u3002<\/li>\n<li>\u5176\u6b21\uff0c\u4f7f\u7528\u7b2c\u4e8c\u4e2a\u53c2\u6570\u6307\u5b9a\u5b57\u7b26\u5411\u91cf\u7684\u683c\u5f0f\uff0c\u4ee5\u544a\u8bc9R\u5982\u4f55\u89e3\u6790\u8be5\u5b57\u7b26\u5411\u91cf\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5b57\u7b26\u5411\u91cf\u662f&quot;2022-01-01&quot;\uff0c\u5219\u683c\u5f0f\u5e94\u4e3a&quot;%Y-%m-%d&quot;\u3002<\/li>\n<li>\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u53ef\u9009\u7684\u7b2c\u4e09\u4e2a\u53c2\u6570\u6765\u6307\u5b9a\u65f6\u533a\u3002\u5982\u679c\u672a\u6307\u5b9a\u65f6\u533a\uff0c\u5219\u51fd\u6570\u5c06\u6839\u636e\u60a8\u7684\u7cfb\u7edf\u8bbe\u7f6e\u81ea\u52a8\u9009\u62e9\u65f6\u533a\u3002<\/li>\n<\/ul>\n<p>\u5c06\u5176\u4ed6\u53c2\u6570\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u540e\uff0cstrptime\u51fd\u6570\u5c06\u8fd4\u56de\u4e00\u4e2a\u65e5\u671f\/\u65f6\u95f4\u5bf9\u8c61\u3002\u60a8\u53ef\u4ee5\u8fdb\u4e00\u6b65\u5904\u7406\u6b64\u5bf9\u8c61\uff0c\u4f8b\u5982\u4f7f\u7528\u5176\u4ed6\u65e5\u671f\/\u65f6\u95f4\u51fd\u6570\u8fdb\u884c\u8ba1\u7b97\u6216\u53ef\u89c6\u5316\u3002<\/p>\n<p><strong>2. \u6211\u5e94\u8be5\u5982\u4f55\u89e3\u51b3R\u8bed\u8a00strptime\u51fd\u6570\u672a\u6b63\u786e\u8f6c\u6362\u5b57\u7b26\u5411\u91cf\u7684\u95ee\u9898\uff1f<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u5728\u4f7f\u7528R\u8bed\u8a00\u4e2d\u7684strptime\u51fd\u6570\u65f6\u9047\u5230\u95ee\u9898\uff0c\u5e76\u4e14\u5b57\u7b26\u5411\u91cf\u672a\u6b63\u786e\u8f6c\u6362\u4e3a\u65e5\u671f\/\u65f6\u95f4\u683c\u5f0f\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<ul>\n<li>\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u6b63\u786e\u6307\u5b9a\u4e86\u5b57\u7b26\u5411\u91cf\u7684\u683c\u5f0f\u3002\u4f7f\u7528\u9519\u8bef\u7684\u683c\u5f0f\u53ef\u80fd\u4f1a\u5bfc\u81f4\u51fd\u6570\u8fd4\u56de\u9519\u8bef\u7684\u7ed3\u679c\u3002\u8bf7\u53c2\u8003R\u8bed\u8a00\u6587\u6863\u6216\u53c2\u8003\u8d44\u6599\uff0c\u4e86\u89e3\u6b63\u786e\u7684\u683c\u5f0f\u4ee3\u7801\u3002<\/li>\n<li>\u5176\u6b21\uff0c\u68c0\u67e5\u5b57\u7b26\u5411\u91cf\u4e2d\u7684\u65e5\u671f\/\u65f6\u95f4\u5b57\u7b26\u4e32\u662f\u5426\u4e0e\u6307\u5b9a\u7684\u683c\u5f0f\u76f8\u5339\u914d\u3002\u65e5\u671f\/\u65f6\u95f4\u5b57\u7b26\u4e32\u5fc5\u987b\u4e0e\u683c\u5f0f\u4e00\u81f4\uff0c\u5426\u5219\u51fd\u6570\u5c06\u65e0\u6cd5\u6b63\u786e\u89e3\u6790\u3002<\/li>\n<li>\u5982\u679c\u5b57\u7b26\u5411\u91cf\u4e2d\u5305\u542b\u4e86\u65e0\u6548\u7684\u65e5\u671f\/\u65f6\u95f4\u5b57\u7b26\u4e32\uff0c\u4f8b\u5982&quot;2022-02-30&quot;\uff082\u6708\u6ca1\u670930\u53f7\uff09\uff0c\u5219\u51fd\u6570\u4e5f\u4f1a\u51fa\u9519\u3002\u8bf7\u786e\u4fdd\u6240\u6709\u7684\u65e5\u671f\/\u65f6\u95f4\u5b57\u7b26\u4e32\u90fd\u662f\u6709\u6548\u7684\u3002<\/li>\n<li>\u6700\u540e\uff0c\u68c0\u67e5\u65f6\u533a\u53c2\u6570\u662f\u5426\u6b63\u786e\u3002\u5982\u679c\u672a\u6307\u5b9a\u65f6\u533a\uff0c\u5219\u51fd\u6570\u5c06\u6839\u636e\u7cfb\u7edf\u8bbe\u7f6e\u8fdb\u884c\u89e3\u6790\u3002\u5982\u679c\u60a8\u7684\u7cfb\u7edf\u65f6\u533a\u8bbe\u7f6e\u4e0d\u6b63\u786e\uff0c\u90a3\u4e48\u51fd\u6570\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u89e3\u6790\u65e5\u671f\/\u65f6\u95f4\u3002<\/li>\n<\/ul>\n<p><strong>3. strptime\u51fd\u6570\u662f\u5426\u6709\u5176\u4ed6\u5e38\u89c1\u7684\u5e94\u7528\u573a\u666f\uff1f<\/strong><\/p>\n<p>\u9664\u4e86\u5c06\u5b57\u7b26\u5411\u91cf\u8f6c\u6362\u4e3a\u65e5\u671f\/\u65f6\u95f4\u683c\u5f0f\uff0cR\u8bed\u8a00\u4e2d\u7684strptime\u51fd\u6570\u8fd8\u6709\u5176\u4ed6\u5e38\u89c1\u7684\u5e94\u7528\u573a\u666f\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u5c06\u4e0d\u540c\u65e5\u671f\/\u65f6\u95f4\u683c\u5f0f\u7684\u5b57\u7b26\u5411\u91cf\u8f6c\u6362\u4e3a\u7edf\u4e00\u7684\u65e5\u671f\/\u65f6\u95f4\u683c\u5f0f\u3002\u901a\u8fc7\u6307\u5b9a\u9002\u5f53\u7684\u683c\u5f0f\u4ee3\u7801\uff0c\u53ef\u4ee5\u5c06\u4e0d\u540c\u683c\u5f0f\u7684\u65e5\u671f\/\u65f6\u95f4\u5b57\u7b26\u4e32\u7edf\u4e00\u8f6c\u6362\u4e3a\u7edf\u4e00\u7684\u683c\u5f0f\uff0c\u65b9\u4fbf\u540e\u7eed\u5904\u7406\u6216\u5206\u6790\u3002<\/li>\n<li>\u89e3\u6790\u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u65e5\u671f\/\u65f6\u95f4\u4fe1\u606f\u3002\u5982\u679c\u60a8\u9700\u8981\u4ece\u65e5\u5fd7\u6587\u4ef6\u4e2d\u63d0\u53d6\u65e5\u671f\/\u65f6\u95f4\u4fe1\u606f\u8fdb\u884c\u5206\u6790\uff0c\u53ef\u4ee5\u4f7f\u7528strptime\u51fd\u6570\u5c06\u5b57\u7b26\u5411\u91cf\u8f6c\u6362\u4e3a\u65e5\u671f\/\u65f6\u95f4\u683c\u5f0f\uff0c\u7136\u540e\u8fdb\u884c\u76f8\u5173\u8ba1\u7b97\u6216\u53ef\u89c6\u5316\u3002<\/li>\n<li>\u8fdb\u884c\u65e5\u671f\/\u65f6\u95f4\u6570\u636e\u7684\u7b5b\u9009\u548c\u5b50\u96c6\u64cd\u4f5c\u3002\u901a\u8fc7\u5c06\u5b57\u7b26\u5411\u91cf\u8f6c\u6362\u4e3a\u65e5\u671f\/\u65f6\u95f4\u683c\u5f0f\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528R\u8bed\u8a00\u4e2d\u4e30\u5bcc\u7684\u65e5\u671f\/\u65f6\u95f4\u51fd\u6570\u8fdb\u884c\u7b5b\u9009\u548c\u5b50\u96c6\u64cd\u4f5c\uff0c\u4f8b\u5982\u9009\u62e9\u67d0\u4e2a\u65f6\u95f4\u6bb5\u5185\u7684\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u7075\u6d3b\u8fd0\u7528strptime\u51fd\u6570\uff0c\u60a8\u53ef\u4ee5\u66f4\u597d\u5730\u5904\u7406\u548c\u5206\u6790\u65e5\u671f\/\u65f6\u95f4\u6570\u636e\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u548c\u51c6\u786e\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"strptime\u51fd\u6570\u5728R\u8bed\u8a00\u4e2d\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u65f6\u95f4\u6570\u636e\u8f6c\u6362\u4e3a\u65e5\u671f\u65f6\u95f4\uff08Date-Time\uff09\u5bf9\u8c61\u3002\u8be5\u51fd\u6570\u5141\u8bb8\u7528 [&hellip;]","protected":false},"author":3,"featured_media":180940,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/180923"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=180923"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/180923\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/180940"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=180923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=180923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=180923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}