Imports System
Class Sample
Shared Sub Main()
Dim dateTimeArray As DateTime() = New DateTime() { _
New DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Local), _
New DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc), _
New DateTime(2000, 1, 1, 6, 0, 0, DateTimeKind.Utc), _
New DateTime(2000, 1, 1, 18, 0, 0, DateTimeKind.Utc), _
New DateTime(2000, 1, 2, 0, 0, 0, DateTimeKind.Local), _
New DateTime(2000, 1, 2, 0, 0, 0, DateTimeKind.Utc) _
}
Dim dateTimeOffsetArray As DateTimeOffset() = New DateTimeOffset() { _
New DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan( 0, 0, 0)), _
New DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(-5, 0, 0)), _
New DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(+9, 0, 0)), _
New DateTimeOffset(2000, 1, 2, 0, 0, 0, new TimeSpan( 0, 0, 0)), _
New DateTimeOffset(2000, 1, 2, 0, 0, 0, new TimeSpan(-5, 0, 0)), _
new DateTimeOffset(2000, 1, 2, 0, 0, 0, new TimeSpan(+9, 0, 0)) _
}
Array.Sort(dateTimeArray)
Array.Sort(dateTimeOffsetArray)
Console.WriteLine("DateTime")
For Each val As DateTime In dateTimeArray
Console.WriteLine("{0,-35:o} ({1:o})", val, val.ToUniversalTime())
Next
Console.WriteLine("DateTimeOffset")
For Each val As DateTimeOffset In dateTimeOffsetArray
Console.WriteLine("{0,-35:o} ({1:o})", val, val.ToUniversalTime())
Next
End Sub
End Class