Sub ConnectionTest
Dim j As HttpJob
j.Initialize("", Me)
j.Download(rdCheck)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
Dim str1 As String = j.GetString
If str1.Contains("successful") Then
str1 = str1.SubString2(25,44) 'get date time from string
Do While str1.Contains(" ")
str1 = str1.Replace(" ","|")
Loop
Dim serverDateTime() As String
serverDateTime = Regex.Split("\|", str1.Trim)
Log(serverDateTime(0))
Log(serverDateTime(1))
DateTime.DateFormat = "MM/dd/yyyy"
DateTime.TimeFormat = "HH:mm:ss"
Dim t As Long = DateTime.DateTimeParse(serverDateTime(0), serverDateTime(1))
Dim addTimeZoneOffsetTicks As Long
Dim fTimeZoneOffset As Float
fTimeZoneOffset = DateTime.GetTimeZoneOffsetAt(t)
addTimeZoneOffsetTicks = fTimeZoneOffset * (60*60*1000)
Log(DateTime.Date(t) & " " & DateTime.Time(t))
'lblLocalTime.Text = DateTime.Time(t)
Log(DateTime.TimeZoneOffset)
Log(DateTime.Now)
Dim strDate As String
Dim strTime As String
DateTime.DateFormat="MM/dd/yyy HH:mm:ss"
Dim strDate As String=DateTime.Date(DateTime.Now)
Dim strTime As String= DateTime.Time(DateTime.Now)
Dim n As Long = DateTime.DateTimeParse(strDate, strTime)
Log(n)
Log(t)
Log(addTimeZoneOffsetTicks)
Dim a As Long
a = t + addTimeZoneOffsetTicks
Log(a)
Log(strDate)
Log(strTime)
Log(DateUtils.TicksToString(a))
lblLocalTime.Text =DateUtils.TicksToString(a)
Else
'lblLocalTime.Text =""
End If
Else
Log("Connect error")
'lblStatus.Text ="Error connection"
End If
j.Release
End Sub