Exemplo n.º 1
0
 /// <summary>
 /// 设置本地日期时间
 /// </summary>
 /// <param name="dataTime">日期时间</param>
 public static void SetLocalDateTime(DateTime dataTime)
 {
     Systemtime dt = new Systemtime
     {
         wYear = ushort.Parse(dataTime.Year.ToString(CultureInfo.InvariantCulture)),
         wMonth = ushort.Parse(dataTime.Month.ToString(CultureInfo.InvariantCulture)),
         wDay = ushort.Parse(dataTime.Day.ToString(CultureInfo.InvariantCulture)),
         wHour = ushort.Parse(dataTime.Hour.ToString(CultureInfo.InvariantCulture)),
         wMinute = ushort.Parse(dataTime.Minute.ToString(CultureInfo.InvariantCulture)),
         wSecond = ushort.Parse(dataTime.Second.ToString(CultureInfo.InvariantCulture))
     };
     SetLocalTime(ref dt);
 }
Exemplo n.º 2
0
 public static extern bool SetLocalTime(ref Systemtime lpSystemTime);
Exemplo n.º 3
0
 public static extern void GetLocalTime(ref Systemtime sysTime);