which is I will get a date time from server and update current PC date and time based on server date and time.
I got this code from internet...
Public Structure SYSTEMTIME Public wYear As UInt16 Public wMonth As UInt16 Public wDayOfWeek As UInt16 Public wDay As UInt16 Public wHour As UInt16 Public wMinute As UInt16 Public wSecond As UInt16 Public wMilliseconds As UInt16 End Structure Declare Auto Function GetSystemTime Lib "Kernel32.dll" _ (ByRef lpSystemTime As SYSTEMTIME) As UInt32 Declare Auto Function SetSystemTime Lib "Kernel32.dll" _ (ByRef lpSystemTime As SYSTEMTIME) As UInt32 Public Sub GetTime() ' Call the native GetSystemTime method ' with the defined structure. Dim st As New SYSTEMTIME GetSystemTime(st) ' Show the current time. MsgBox("Current Time: " & st.wHour.ToString() _ & ":" & st.wMinute.ToString()) End Sub Public Sub SetTime() ' Call the native GetSystemTime method ' with the defined structure. Dim st As New SYSTEMTIME GetSystemTime(st) ' Set the system clock ahead one hour. st.wHour = Convert.ToUInt16((CInt(st.wDay) + 1)) SetSystemTime(st) MsgBox("Current dat3e: " & st.wHour.ToString()) '_ ' & ":" & st.wMinute.ToString()) End Sub
there is no error with this code... but nothing happens when i'm changing the date...
i'm using visual studio 2010.. can anyone show me how to update current PC system date and time??
Thank so much...
This post has been edited by macosxnerd101: 19 September 2011 - 06:36 PM
Reason for edit:: Please use code tags