我们如何在 vb.net 中实现这一点:获取一天的开始时间和一天的结束时间
例如
Start DateTime: 05-Nov-2013 00:00:00
End DateTime: 05-Nov-2013 23:59:99
问候
我们如何在 vb.net 中实现这一点:获取一天的开始时间和一天的结束时间
例如
Start DateTime: 05-Nov-2013 00:00:00
End DateTime: 05-Nov-2013 23:59:99
问候
您可以TimeSpan
像这样将 a 添加到日期值:
Dim dateValue As DateTime = DateTime.Now
Dim startTime As DateTime = dateValue.Date + New TimeSpan(0, 0, 0) 'timespan addition not actually needed here
Dim endTime As DateTime = dateValue.Date + New TimeSpan(23, 59, 59)
Dim start As DateTime = yourDate.Date
Dim endTime As DateTime = yourDate.Date.AddDays(1).AddSeconds(-1)
我的 $.02
Dim someDate As DateTime = DateTime.Now
Dim StartDateTime As DateTime = someDate.Date
'last measurable instant for a given date
Dim EndDateTime As DateTime = someDate.Date.Add(New TimeSpan(TimeSpan.TicksPerDay - 1))