static public DateTime Convert(SYSTEMTIME sys) { DateTime dt = new DateTime(sys.wYear, sys.wMonth, sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds); //dt.Year = (int)sys.wYear; //dt.Month = (int)sys.wMonth; //dt.Day = (int)sys.wDay; //dt.Hour = (int)sys.wHour; //dt.Minute = (int)sys.wMinute; //dt.Second = (int)sys.wSecond; //dt.Milliseconds = (int)sys.wMillisecond; return dt; }
static public SYSTEMTIME Convert(DateTime dt) { SYSTEMTIME sys = new SYSTEMTIME(); sys.wYear = (ushort)dt.Year; sys.wMonth = (ushort)dt.Month; sys.wDay = (ushort)dt.Day; sys.wHour = (ushort)dt.Hour; sys.wMinute = (ushort)dt.Minute; sys.wSecond = (ushort)dt.Second; sys.wMilliseconds = (ushort)dt.Millisecond; return sys; }