Function DateToISO8601String(date As Object, includeZ = True As Boolean) As String
iso8601 = PadLeft(date.GetYear().ToStr(), "0", 4)
iso8601 = iso8601 + "-"
iso8601 = iso8601 + PadLeft(date.GetMonth().ToStr(), "0", 2)
iso8601 = iso8601 + "-"
iso8601 = iso8601 + PadLeft(date.GetDayOfMonth().ToStr(), "0", 2)
iso8601 = iso8601 + "T"
iso8601 = iso8601 + PadLeft(date.GetHours().ToStr(), "0", 2)
iso8601 = iso8601 + ":"
iso8601 = iso8601 + PadLeft(date.GetMinutes().ToStr(), "0", 2)
iso8601 = iso8601 + ":"
iso8601 = iso8601 + PadLeft(date.GetSeconds().ToStr(), "0", 2)
If includeZ Then
iso8601 = iso8601 + "Z"
End If
Return iso8601
End Function
Function PadLeft(value As String, padChar As String, totalLength As Integer) As String
While value.Len() < totalLength
value = padChar + value
End While
Return value
End Function
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)