Module IntervalArithmetic
Public Sub Main()
Dim generalTime As Date = #03/09/2010 1:30AM#
Const tzName As String = "Central Standard Time"
Dim twoAndAHalfHours As New TimeSpan(2, 30, 0)
Try
Dim centralTime1 As New DateTimeOffset(generalTime,TimeZoneInfo.FindSystemTimeZoneById(tzName).GetUtcOffset(generalTime))
Dim centralTime2 As DateTimeOffset = centralTime1.Add(twoAndAHalfHours)
Console.WriteLine("{0} + {1} hours = {2}", centralTime1, _
twoAndAHalfHours.ToString(), _
centralTime2)
Catch e As TimeZoneNotFoundException
Console.WriteLine("Unable to retrieve Central Standard Time zone information.")
End Try
End Sub
End Module