1
我有登录和注销事件,我需要计算它们之间的时间。计算不同行两个日期之间的时间间隔
我想我可以分组每2行(每两个消息),然后做计算,但你会怎么做?
示例XML我需要查询:
<Log>
<Message>
<DateTime>2009-12-02 14:38:41</DateTime>
<Priority>Local3.Info</Priority>
<Source_Host>192.168.0.100</Source_Host>
<MessageText>Dec 2 14:38:41 root: login,ng1,192.168.0.160,janis.veinbergs</MessageText>
</Message>
<Message>
<DateTime>2009-12-02 15:28:19</DateTime>
<Priority>Local3.Info</Priority>
<Source_Host>192.168.0.100</Source_Host>
<MessageText>Dec 2 15:30:33 root: logout,ng1,,janis.veinbergs</MessageText>
</Message>
<Message>
<DateTime>2009-12-02 15:29:11</DateTime>
<Priority>Local3.Info</Priority>
<Source_Host>192.168.0.100</Source_Host>
<MessageText>Dec 2 15:31:25 root: login,ng1,192.168.0.160,janis.veinbergs</MessageText>
</Message>
<Message>
<DateTime>2009-12-02 15:58:22</DateTime>
<Priority>Local3.Info</Priority>
<Source_Host>192.168.0.100</Source_Host>
<MessageText>Dec 2 16:00:37 root: logout,ng1,,janis.veinbergs</MessageText>
</Message>
</Log>
三江源。
嗯,我也没有ID列。查看我的编辑,例如我正在查询的XML。 – 2009-12-03 09:54:10
刚刚更新以符合所提供的XML – Marcus 2009-12-03 11:31:44
谢谢。代码没有直接工作(data.Elements())没有返回任何结果,但是我调整了它,让它工作的重要部分是用于返回“results”变量的查询。 非常感谢。 – 2009-12-03 11:59:28