如何计算两个像元之间的时间差(以秒为单位),其中像元以“ yyyy-mm-dd hh:mm:ss”格式设置为文本?

时间:2019-04-16 20:55:21

标签: excel excel-formula excel-2003

如何计算两个文本单元格之间的时间差(以秒为单位),其中单元格的格式为“ yyyy-mm-dd hh:mm:ss”?

感谢一百万个家伙!

2019-03-21 09:53:56
2019-03-21 09:54:25
2019-03-21 14:10:36
2019-03-21 14:10:42
2019-03-22 11:49:16
2019-03-22 11:49:51
2019-03-22 11:50:21
2019-03-22 11:50:50

2 个答案:

答案 0 :(得分:0)

当您在excel中减去两个日期时间时,您将以小数形式返回的天数降至秒的精度。

因此2019-03-21 09:53:56 - 2019-03-21 09:54:25将给您:0.000335648作为回报。您可以将该时间乘以一天中的秒数来获得答案0.000335648*24*60*60 = 29 seconds

在公式中,该值为=(A2-A1)*24*60*60

enter image description here

答案 1 :(得分:0)

If your date-times are entered as text, you can use something like this to convert them into values Excel can use for calculations:

=DATEVALUE(LEFT(A1,10)) + TIMEVALUE(RIGHT(A1,8))

To convert a difference between two such values to seconds, multiply by 86400 (24*60*60)

相关问题