如何比较c#中两个时间间隔之间的时间 [英] how to compare the time between the two time intervals in c#
问题描述
当管理员设置开始时间和结束时间时。小时看到示例
现在的开始时间是19/05/2015 11.00AM,结束时间是20/05/2015 6.00 pm
它将是时间段。而用户将登录时间以下其他时间阻止登录过程。你能建议我如何实现这一点。
Quote:DateTime start = new DateTime(2015,05,19,11,00,00,00);
DateTime end = new DateTime(2015,05,20,6,00,00,00);
TimeSpan时间跨度;
timespan = end - 开始;
double timeDifference = timespan.TotalHours;
Console.WriteLine(时差为:+ timeDifference);
控制台。 ReadKey();
When the admin will set the starting time and ending time.lets see the example
Now the staring time is 19/05/2015 11.00AM and the ending time is 20/05/2015 6.00pm
its will be the time period.while the user will logon below time peroid else block the login process.Can you suggest me how to achive this.
Quote:DateTime start = new DateTime(2015,05,19,11,00,00,00);
DateTime end = new DateTime(2015,05,20,6,00,00,00);
TimeSpan timespan;
timespan = end - start;
double timeDifference = timespan.TotalHours;
Console.WriteLine("Time Difference is :" + timeDifference);
Console.ReadKey();
这篇关于如何比较c#中两个时间间隔之间的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!