Tag: date math

C#方法总结hh:mm数据???

我想要一种方法,它将以hh:mm格式(时间小时和分钟)对字符串数据求和 0:15 + 0:15 = 0:30

在C#中处理时间的简单方法?

我目前的做法是这样的 DateTime startHour = new DateTime(1900,1,1,12,25,43); DateTime endHour = new DateTime(1900,1,1,13,45,32); // I need to, say, know if a complete DateTime instance // is later than startHour plus 15 minutes DateTime now = DateTime.Now(); startHour = startHour.addMinutes(15); if (now.CompareTo(new DateTime(now.Year, now.Month, now.Day, startHour.Hour, startHour.Minute, startHour.Second)) > 0) { //I can do something now } 这非常麻烦甚至容易出错。 […]