以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 时间计算 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=139735) |
-- 作者:有点酸 -- 发布时间:2019/8/20 16:18:00 -- Dim Hours As Integer = 6 \'间隔时间 Dim dt1 As Date = #8/20/2019 19:30# \'开始时间 Dim dt2 As Date Dim t1 As Date = dt1.Date.AddHours(20) \'当天晚8点 Dim t2 As Date = dt1.Date.Addhours(32) \'第二天早8点 If dt1.AddHours(hours) > t1 Then Dim h1 As Double = (t1 - dt1).TotalHours dt2 = t2.AddHours(Hours - h1) Else dt2 = dt1.AddHours(hours) End If Return dt2
[此贴子已经被作者于2019/8/20 17:23:04编辑过]
|