Example #1
0
 public static bool StaticSetLocalTime(DateTime times)
 {
     bool rebool = false;
     SystemTime st = new SystemTime();
     st.wYear = Convert.ToInt16(times.ToString("yyyy"));
     st.wMonth = Convert.ToInt16(times.ToString("MM"));
     st.wDay = Convert.ToInt16(times.ToString("dd"));
     st.wHour = Convert.ToInt16(times.ToString("HH"));
     st.wMinute = Convert.ToInt16(times.ToString("mm"));
     st.wSecond = Convert.ToInt16(times.ToString("ss"));
     if (SetLocalTime(ref st) == 1) { rebool = true; }
     else { rebool = false; }
     return rebool;
 }
Example #2
0
 private static extern int SetLocalTime(ref SystemTime lpSystemTime);
Example #3
0
 public static bool StaticSetLocalTime(short Year, short Month, short Day, short Hour, short Minute, short Second)
 {
     bool rebool = false;
     SystemTime st = new SystemTime();
     st.wYear = Year;
     st.wMonth = Month;
     st.wDay = Day;
     st.wHour = Hour;
     st.wMinute = Minute;
     st.wSecond = Second;
     if (SetLocalTime(ref st) == 1) { rebool = true; }
     else { rebool = false; }
     return rebool;
 }