{"id":1525,"date":"2021-05-30T17:05:00","date_gmt":"2021-05-30T09:05:00","guid":{"rendered":"https:\/\/www.fyndpro.com\/?p=1525"},"modified":"2026-08-27T16:14:49","modified_gmt":"2026-08-27T08:14:49","slug":"calculate-the-years-months-and-days-between-two-dates","status":"publish","type":"post","link":"https:\/\/www.fyndpro.com\/cn\/calculate-the-years-months-and-days-between-two-dates\/","title":{"rendered":"\u8a08\u7b97\u5169\u500b\u65e5\u671f\u76f8\u5dee\u7684\u5e74\u3001\u6708\u3001\u65e5"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1955\" src=\"https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=1024%2C576&#038;ssl=1\" alt=\"\" width=\"1024\" height=\"576\" srcset=\"https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=18%2C10&amp;ssl=1 18w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=1000%2C563&amp;ssl=1 1000w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=230%2C129&amp;ssl=1 230w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=350%2C197&amp;ssl=1 350w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?resize=480%2C270&amp;ssl=1 480w, https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2020\/10\/17.jpg?w=1200&amp;ssl=1 1200w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>\u8981\u8a08\u7b97\u5169\u500b\u65e5\u671f\u4e4b\u9593\u7684\u5e74\u3001\u6708\u3001\u65e5\u6578\uff0c\u4e26\u5728\u672a\u6eff\u4e00\u5e74\u7684\u60c5\u6cc1\u4e0b\u4e0d\u986f\u793a\u5e74\uff0c\u55ae\u7d14\u76f8\u6e1b\u4e0d\u8db3\u4ee5\u9054\u6210\uff0c\u5fc5\u9808\u4f7f\u7528\u7279\u5b9a\u516c\u5f0f\u3002<\/p>\n<p><strong>Formula<\/strong><br \/>\n\u516c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<div>\n<div>\n<div data-collapsed=\"unknown\">\n<p><strong><em>=TEXT(DATEDIF(A2,B2,\u201dy\u201d),\u201d#\u5e74;;;\u201d)&amp;TEXT(DATEDIF(A2,B2,\u201dym\u201d),\u201d#\u6708;;;\u201d)&amp;TEXT(DATEDIF(A2,B2,\u201dmd\u201d),\u201d#\u5929;;;\u201d) <\/em><\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u516c\u5f0f\u8aaa\u660e<\/strong><\/p>\n<ul>\n<li><code>DATEDIF(A2,B2,\u201dy\u201d)<\/code>: \u8a08\u7b97 A2 \u8207 B2 \u4e4b\u9593\u6709\u591a\u5c11\u6574\u5e74\u3002\u8209\u4f8b\uff0c\u5f9e 2019 \u5e74 5 \u6708 16 \u65e5\u5230 2019 \u5e74 6 \u6708 25 \u65e5\u70ba 0 \u5e74\u3002<\/li>\n<li><code>TEXT(DATEDIF(A2,B2,\u201dy\u201d),\u201d#\u5e74;;;\u201d)<\/code>: \u986f\u793a\u7531 DATEDIF(A2,B2,\u201dy\u201d) \u6240\u53d6\u5f97\u7684\u6574\u5e74\u6578\u3002\u00a0<code>DATEDIF(A2,B2,\u201dy\u201d)<\/code>\u00a0\u4ee5 \u201c#\u5e74;;;\u201d \u7684\u683c\u5f0f\u986f\u793a\u3002<\/li>\n<\/ul>\n<p>\u6b64\u683c\u5f0f\u4ee5\u4e09\u500b\u5206\u865f\u5206\u9694\uff0c\u4ee3\u8868\u63a5\u4e0b\u4f86\u56db\u7a2e\u503c\u5c0d\u61c9\u7684\u56db\u7a2e\u683c\u5f0f\uff1a<\/p>\n<ol>\n<li>\u6b63\u6578\u683c\u5f0f<\/li>\n<li>\u8ca0\u6578\u683c\u5f0f<\/li>\n<li>\u96f6\u503c\u683c\u5f0f<\/li>\n<li>\u6587\u5b57\u683c\u5f0f<\/li>\n<\/ol>\n<p>\u201c#\u5e74;;;\u201d \u8868\u793a\u5167\u5bb9\u70ba\u6b63\u6578\u6642\u6703\u4ee5 \u201c#\u5e74\u201d \u683c\u5f0f\u986f\u793a\uff1b\u82e5\u70ba\u8ca0\u6578\u3001\u96f6\u6216\u6587\u5b57\u5247\u986f\u793a\u70ba\u7a7a\u767d\u3002\u56e0\u70ba\u5dee\u7570\u53ea\u6703\u662f\u6b63\u6578\u6216\u96f6\uff0c\u82e5\u6709\u4e00\u500b\u6216\u4ee5\u4e0a\u7684\u6574\u5e74\u5247\u4ee5 \u201c#\u5e74\u201d \u986f\u793a\uff0c\u5426\u5247\u4e0d\u986f\u793a\u3002<\/p>\n<ul>\n<li><code>DATEDIF(A2,B2,\u201dym\u201d)<\/code>: \u8a08\u7b97 A2 \u8207 B2 \u4e4b\u9593\u6709\u591a\u5c11\u6574\u6708\uff08\u4e0d\u8a08\u5e74\u4efd\uff09\u3002\u4f8b\u5982\uff0c\u5f9e 2019 \u5e74 5 \u6708 16 \u65e5\u5230 2019 \u5e74 6 \u6708 25 \u65e5\u70ba 1 \u500b\u6708\uff1b\u5f9e 2011 \u5e74 2 \u6708 3 \u65e5\u5230 2012 \u5e74 11 \u6708 14 \u65e5\u70ba 9 \u500b\u6708\uff0c\u800c\u4e0d\u662f 21 \u500b\u6708\u3002<\/li>\n<li><code>TEXT(DATEDIF(A2,B2,\u201dym\u201d),\u201d#\u6708;;;\u201d)<\/code>: \u8207\u524d\u8ff0\u76f8\u540c\u3002\u00a0<code>TEXT(DATEDIF(A2,B2,\u201dy\u201d),\u201d#\u5e74;;;\u201d)<\/code>.<\/li>\n<li><code>TEXT(DATEDIF(A2,B2,\u201dmd\u201d),\u201d#\u5929;;;\u201d)<\/code>: \u529f\u80fd\u8207\u524d\u8ff0\u985e\u4f3c\u3002\u00a0<code>TEXT(DATEDIF(A2,B2,\u201dy\u201d),\u201d#\u5e74;;;\u201d)<\/code>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u8a08\u7b97\u5169\u500b\u65e5\u671f\u4e4b\u9593\u7684\u5e74\u3001\u6708\u3001\u65e5\u6578\uff0c\u4e26\u5728\u672a\u6eff\u4e00\u5e74\u7684\u60c5\u6cc1\u4e0b\u4e0d\u986f\u793a\u5e74\uff0c\u55ae\u7d14\u76f8\u6e1b\u4e0d\u8db3\u4ee5\u9054\u6210\uff0c\u5fc5\u9808\u4f7f\u7528\u7279\u5b9a\u516c\u5f0f\u3002 For [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3792,"comment_status":"closed","ping_status":"open","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_post_was_ever_published":false},"categories":[8,20],"tags":[161,294,162,286,276],"class_list":["post-1525","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel","category-onlinesupport","tag-datedif","tag-excel-formula","tag-text","tag-date-calculation","tag-custom-formatting"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.fyndpro.com\/wp-content\/uploads\/2026\/08\/new_covers_batch_03_1790_excel.jpg?fit=816%2C1088&ssl=1","_links":{"self":[{"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/posts\/1525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/comments?post=1525"}],"version-history":[{"count":8,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/posts\/1525\/revisions"}],"predecessor-version":[{"id":3815,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/posts\/1525\/revisions\/3815"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/media\/3792"}],"wp:attachment":[{"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/media?parent=1525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/categories?post=1525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fyndpro.com\/cn\/wp-json\/wp\/v2\/tags?post=1525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}