我们如何在执行过程中使用此特定代码:
now = new Date();
current_date = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
end_date = obj.end_date (Mon, 02 Apr 2012 20:16:35 GMT);
var millisDiff = end_date.getTime() - current_date.getTime();
console.log(millisDiff / 1000);
我已将记录插入集合中。它由许多参数组成。第一条记录告诉状态开始,最后一条记录告诉该进程已经结束。它们还包括开始时和结束时所有记录中的时间戳值。
如何获得两个流程之间的时间差异?我该如何使用上面的代码?
db.trials.insert( { _id: ObjectId("51d2750d16257024e046c0d7"), Application: "xxx", ProcessContext: "SEARCH", InteractionID: "I001", opID: "BBB", buID: "Default", HostName: "xxx-ttt-tgd-002", InstanceName: "Instance1", EventTime: ISODate("2011-11-03T14:23:00Z"), HOPID: "", HOPName: "", HOPStatus: "", INTStatus: "Started" } );
db.trials.insert( { _id: ObjectId("51d2750d16257024e046c0d7"), Application: "xxx", ProcessContext: "SEARCH", InteractionID: "I001", opID: "BBB", buID: "Default", HostName: "xxx-ttt-tgd-002", InstanceName: "Instance1", EventTime: ISODate("2011-11-03T14:23:58Z"), HOPID: "", HOPName: "", HOPStatus: "", INTStatus: "Started" } );
这些是我想要使用上述逻辑知道时间戳差异的2条记录。我如何使用逻辑,以便我可以得到差异?