Hugo Ebenfeldt on Wed, 30 Apr 2014 12:31:44

Hi! How do I make the application change date to September 18, 2013?

This is the code, works for Windows 7 but not for Windows 8:

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 = "18-September-2013 15:30:00" st.year = NewDate .Year st.month = NewDate.Month st.dayOfWeek = NewDate.DayOfWeek = 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

As I said, this works for Windows 7, but not Windows 8. I don't know what's wrong!



Mr. Monkeyboy on Wed, 30 Apr 2014 15:26:08

You can use the code below. It requires admin privileges to change the system time. The string parsed looks like the image below. I don't have Win 8 to test it on and I'm not sure why your code will not work on 8.

Today = DateTime.Parse("18-September-2013 15:30:00")

Cor Ligthert on Wed, 30 Apr 2014 16:34:11


Sorry, this one I don't test. Many authorization systems are relying on a correct system date and then the installed software get strange behaviour if the date is set back. This is often tried with outdated software but is in fact malicious.

Why you want it anyway to put back to a date in history?