Jump to content
Sign in to follow this  
zhenxin

Anaylze codes for time converter

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?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

What do you mean by "web reference"?

Share this post


Link to post
Share on other sites

One server cannot find out the time on another server.Hang on what web service are you creating?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×