日期/时间的字符串表示形式之间的差异 [英] Differences between string representations of date/times
本文介绍了日期/时间的字符串表示形式之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Excel 2007 中,我想要以下字符串日期/时间的差异:
In Excel 2007, I want the differences for the following string date/times:
A B C
1 Date1 Date2 Difference of A and B
2 2009.11.28 01:25:46:0287 2009.11.28 01:25:46:0287 ?
3 2009.11.28 01:25:46:0443 2009.11.28 01:25:46:0443 ?
我希望通过将字符串转换为日期/时间来获得差异,然后将结果作为两个转换后的日期/时间的差异.
I want the differences by converting strings to date/time and then the results as differences of two converted date/times.
推荐答案
一种相当冗长的计算零的方法(对于示例):
A rather long-winded way to calculate zero (for the examples):
=SUBSTITUTE(LEFT(A2,10),".","/")+MID(A2,12,8)+RIGHT(A2,4)/86400000-(SUBSTITUTE(LEFT(B2,10),".","/")+MID(B2,12,8)+RIGHT(B2,4)/86400000)
应特殊要求且略短:
=SUBSTITUTE(LEFT(A2,10),".","/")+REPLACE(RIGHT(A2,13),9,1,".")-(SUBSTITUTE(LEFT(B2,10),".","/")+REPLACE(RIGHT(B2,13),9,1,"."))
这篇关于日期/时间的字符串表示形式之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文