Gefunden.
Hier der Code:
[DllImport("kernel32.dll", SetLastError=true)]
public static extern int SetLocalTime (ref SystemTime lpSystemTime);
//struct for date/time apis
public struct SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
public static void settime(short day,short month,short year,short hour,short minute,short second)
{
//create a new systemtime
SystemTime systNew = new SystemTime();
//set the properties
systNew.wDay = day;
systNew.wMonth = month;
systNew.wYear = year;
systNew.wHour = hour;
systNew.wMinute = minute;
systNew.wSecond = second;
//and update using the api
SetLocalTime(ref systNew);
}
ABER!
Hier die nächste Frage:
Wie stelle ich die jetzt nach der Atomuhr?