Jump to content

Anaylze codes for time converter


zhenxin

Recommended Posts

Public Function TimeConverter(ByVal time As Integer) As String Dim times As String Dim hour As Double = Date.Now.Hour Dim h As String = " " Dim min As Double = Date.Now.Minute Dim m As String = " " Dim sec As Double = Date.Now.Second Dim s As String = " " Dim ap As String hour += time If (hour < 10) And (hour > 0) Then hour = "0" + hour h = hour ElseIf (hour < 0) Then hour = hour + 12 h = hour Else h = hour End If If (min < 10) Then m = "0" + min Else m = min End If If (sec < 10) Then s = "0" + sec Else s = sec End If If (h <= 11) Then ap = "AM" Else ap = "PM" End If If (h > 12) Then h -= 12 End If times = h + ":" + m + ":" + s + " " + ap Return times End FunctionCan i know where is the place which the server will return the times for different countries like CHina and Malaysia?

Link to comment
Share on other sites

You can't get the server to immediately return those values (it doesn't know) you will need to add the time zone difference between them and add hours / minutes accordingly. For instance, if your server was on the East coast of the USA (GMT - 5) and you wanted the time for China (GMT + 8) then you would do

Dim hour As Double = Date.Now.Hour + 13

Link to comment
Share on other sites

You can't get the server to immediately return those values (it doesn't know) you will need to add the time zone difference between them and add hours / minutes accordingly. For instance, if your server was on the East coast of the USA (GMT - 5) and you wanted the time for China (GMT + 8) then you would do
Dim hour As Double = Date.Now.Hour + 13

But i can get various countries' time back in another website when i add web reference to it.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...