日期:2014-05-17 浏览次数:20805 次
DateTime now = DateTime.Now;
if (now.Hour >= 9 && now.Hour <= 20)
{
long tickk = now.Ticks - (new DateTime(now.Year, now.Month, now.Day, 9, 0, 0)).Ticks;
TimeSpan timeSpan = new TimeSpan(tickk);
Console.WriteLine(timeSpan.TotalHours);
}