[DllImport("Kernel32.dll")] 
private static extern bool SetSystemTime( ref SystemTime sysDate ); 
[DllImport("Kernel32.dll")] 
private static extern void GetSystemTime(ref SystemTime sysDate);  public static void SetSystemDate(System.DateTime newDate)
{
SystemTime sysDate = new SystemTime();  GetSystemTime(ref sysDate); sysDate.wYear = (ushort)newDate.Year; 
sysDate.wMonth = (ushort)newDate.Month; 
sysDate.wDay = (ushort)newDate.Day;  SetSystemTime(ref sysDate); 
}
[StructLayout(LayoutKind.Sequential)] 
public struct SystemTime 

public ushort wYear; 
public ushort wMonth; 
public ushort wDayOfWeek; 
public ushort wDay; 
public ushort wHour; 
public ushort wMinute; 
public ushort wSecond; 
public ushort wMiliseconds;