Two methods:
1. You can use APIs to do the following:
[Structlayout (layoutkind. Sequential)]
Public struct systemtime
{
Public short year;
Public short month;
Public short dayofweek;
Public short day;
Public short hour;
Public short minute;
Public short second;
Public short miliseconds;
}
// API function declaration
[Dllimport ("kernel32.dll", charset = charset. ANSI)]
Public extern static bool setsystemtime (ref systemtime time );
Private void button#click (Object sender, system. eventargs E)
{
// Call the code
Systemtime T = new systemtime ();
T. Year = 2000;
T. month = 1;
T. Day = 2;
T. hour = 12-8; // This function uses the time zone 0. For the time zone + 8, you must calculate the time. if you want to set 12 points, it is 12-8
T. Minute = 5;
Bool v = setsystemtime (ref t );
Console. writeline (V. tostring ());
}
2. The VB.net method is simple.
Today = Date
Timeofday = Time