日期/时间的字符串表示之间的差异 [英] Differences between string representations of date/times

查看:127
本文介绍了日期/时间的字符串表示之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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)  

按特殊要求,稍微缩短一点:

By special request and very slightly shorter:

=SUBSTITUTE(LEFT(A2,10),".","/")+REPLACE(RIGHT(A2,13),9,1,".")-(SUBSTITUTE(LEFT(B2,10),".","/")+REPLACE(RIGHT(B2,13),9,1,"."))

这篇关于日期/时间的字符串表示之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆