EntityReborn
New member
- Joined
- Oct 8, 2008
- Messages
- 3
- Programming Experience
- Beginner
Given: <modified>2008-10-14T24:15:49Z</modified>
Code used:
The given was from a GMail Atom feed (v0.3).
From a bit of research, the Z denotes Zulu time (UTC/GMT 0), yet the hour is 24!? Due to this, the code faults. Any ideas?
Code used:
VB.NET:
Private Function RecoverDate(ByVal inString As String) As String
Dim Match As System.Text.RegularExpressions.Match
Dim TempDate As Date
Dim DateRegex As Regex
Dim TempString As String
Dim Pattern As String = "(?<Date>(?<Year>(?:\d{4}|\d{2}))-(?<Month>0?[1-9]|12|11|10)-(?<Day>[12]\d|0?[1-9]|3[01]))T(?<Time>(?<Hour>(?:\d{2})):(?<Minute>(?:\d{2})):(?<Second>(?:\d{2})))Z"
DateRegex = New Regex(Pattern)
Match = DateRegex.Match(inString)
TempString = Match.Groups("Date").Value & " " & Match.Groups("Time").Value
TempDate = CDate(TempString)
Return TempDate.ToString
End Function
From a bit of research, the Z denotes Zulu time (UTC/GMT 0), yet the hour is 24!? Due to this, the code faults. Any ideas?