我有这个代码,我试图计算两个日期时间之间的差异。这是我的代码:
int counter = 0;
foreach (EDIFile TimeDiff in FilesInfo)
{
if (FilesInfo[counter].outfileDateTime != DateTime.MinValue && FilesInfo[counter].infileDateTime != DateTime.MinValue)
{
FilesInfo[counter].timeDiff = TimeDiff.outfileDateTime - TimeDiff.infileDateTime;
}
counter++;
}
我需要知道的是在几分钟和几秒内显示结果时间跨度timeDiff的语法。我已经完成了大量的搜索,所有关于这个主题的微软页面都是垃圾。有人可以帮忙吗?提前感谢您提供的任何帮助。
答案 0 :(得分:0)
假设//The iframe generated from AMP does not give an ID so I have added one
$('#AMP_1 iframe').attr('id', 'yt_player');
//Load API code
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('yt_player', {
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady() {
console.log("READY");
}
function onPlayerStateChange() {
console.log("STATE CHANGE");
}
是FilesInfo[counter].timeDiff
,您可以将TimeSpan
属性与TotalMinutes
属性结合使用:
Seconds