|
-
Apr 28th, 2011, 07:15 PM
#1
Thread Starter
Hyperactive Member
Change the system Date/Time
as per the title, does anyone know how to Change the System Date/Time via VB.Net?
thanks in advance
Last edited by stingrae; Apr 28th, 2011 at 07:45 PM.
Reason: Resolved
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Apr 28th, 2011, 07:44 PM
#2
Thread Starter
Hyperactive Member
Re: Change the system Date/Time
Found how to:
(if this is not the best way, please add)
Code:
Private Structure SYSTEMTIME
Public year As Short
Public month As Short
Public dayOfWeek As Short
Public day As Short
Public hour As Short
Public minute As Short
Public second As Short
Public milliseconds As Short
End Structure
<DllImport("Kernel32.dll")> Private Shared Function SetLocalTime(ByRef time As SYSTEMTIME) As Boolean
End Function
Private Sub ChangeDate
Dim st As SYSTEMTIME
Dim NewDate As Date = "28-April-1978 22:30:00"
st.year = NewDate .Year
st.month = NewDate.Month
st.dayOfWeek = NewDate.DayOfWeek
st.day = NewDate.Day
st.hour = NewDate.Hour
st.minute = NewDate.Minute
st.second = NewDate.Second
st.milliseconds = NewDate.Millisecond
'Set the new time...
SetLocalTime(st)
End Sub
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|