I am retrieving a time-stamp that can come in one of three flavors:
"2014-01-01T03:08:04+0000" or "2014-01-02T17:06:18.866Z" or "Sun Jan 05 22:54:05 +0000 2014". When I dealt with these in .NET I used the built-in properties of the Date object to convert them to/from local time:
I have not been able to find something equivalent in your DateTime library, how would I go about translating these functions to B4A?
Thanks in advance,
- Richard
"2014-01-01T03:08:04+0000" or "2014-01-02T17:06:18.866Z" or "Sun Jan 05 22:54:05 +0000 2014". When I dealt with these in .NET I used the built-in properties of the Date object to convert them to/from local time:
B4X:
Public Function UTCToLocalTime(ByVal UTCTime As String) As Date
Dim strDT As String = UTCTime
Dim datDT As DateTime = DateTime.Parse(strDT, System.Globalization.CultureInfo.InvariantCulture)
datDT = datDT.ToLocalTime
Return datDT
End Function
Public Function LocalTimeToUTC(ByVal LocalTime As Date) As String
Dim datDT As DateTime
datDT = LocalTime.ToUniversalTime
Dim strDT As String = datDT.ToString(System.Globalization.CultureInfo.InvariantCulture)
Return strDT
End Function
Thanks in advance,
- Richard
Last edited: