如何获得共享点计算列中两个日期之间的差异
how to get difference between two dates in sharepoint calculated column
如何区分两个日期:column1 "joining date" column2 "leaving date",在 Sharepoint 计算列中为 "total experience of an employee"?
我正在搜索的所需输出采用这种格式,例如:“2 天 2 个月 2 年”。
这个公式应该会给你想要的答案
= DATEDIF([Date 1],[Date 2],"MD")&" Days "& DATEDIF([Date 1],[Date 2],"YM") &" Months "& DATEDIF([Date 1],[Date 2],"Y") &" Years"
步骤:
- 创建单行文本类型的计算列
- 使用上面的公式。
解释:
公式为
DATEDIF(Start_date,End_date,"Interval")
其中间隔可以是:
- Y计算完整年数
- M计算完整月数
- D计算天数
- YM计算不含年的月数
- MD计算除去年月的天数
- YD计算不含年的天数
对于日期 1 (31/01/2020) 和日期 2 (14/05/2020) 等 2 个日期,结果将为:
14 Days 3 Months 0 Years
如何区分两个日期:column1 "joining date" column2 "leaving date",在 Sharepoint 计算列中为 "total experience of an employee"?
我正在搜索的所需输出采用这种格式,例如:“2 天 2 个月 2 年”。
这个公式应该会给你想要的答案
= DATEDIF([Date 1],[Date 2],"MD")&" Days "& DATEDIF([Date 1],[Date 2],"YM") &" Months "& DATEDIF([Date 1],[Date 2],"Y") &" Years"
步骤:
- 创建单行文本类型的计算列
- 使用上面的公式。
解释:
公式为
DATEDIF(Start_date,End_date,"Interval")
其中间隔可以是:
- Y计算完整年数
- M计算完整月数
- D计算天数
- YM计算不含年的月数
- MD计算除去年月的天数
- YD计算不含年的天数
对于日期 1 (31/01/2020) 和日期 2 (14/05/2020) 等 2 个日期,结果将为:
14 Days 3 Months 0 Years