Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello my application displays ntp time but needs to add one hour to do?


VB
Private Sub sntpClient_QueryServerCompleted(ByVal sender As System.Object, ByVal e As QueryServerCompletedEventArgs) Handles SntpClient1.QueryServerCompleted
            If e.Succeeded Then
                ListView1.Items.Clear()
                ListView1.Items.AddRange(New ListViewItem() { _
     _
                    New ListViewItem(New String() _
                    {String.Format("{0:yyyy/MM/dd H:mm:ss}", _
                        e.Data.ReceiveDateTime, e.Data.ReceiveDateTime.Millisecond)})})
    
            End If
    
        End Sub
Posted
Updated 16-Nov-14 5:20am
v2

1 solution

Your post is not formulated as a correct question. If this is a question on how to add an hour, this is how:
http://msdn.microsoft.com/en-us/library/system.datetime.addhours(v=vs.110).aspx[^].

Also, if looks like you have a bug with Milliseconds. In, format, you have only one parameter, but in String.Format call, you use two. You don't need the second parameter. One DateTime parameters will be enough, only add a millisecond format specifier "fff" to your format string. Please see:
http://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900