[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;
}
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;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货