Setting System Time
-
Does anyone know the best method to use to set the system time using C#? I am looking for the best way to programmatically set the time on my computer. Thanks!
For this purpose I couldn't find anything more than API
SetSystemTime()
.Its very hard for me to use win32 API in C# but for some jobs its the only way. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down -
Does anyone know the best method to use to set the system time using C#? I am looking for the best way to programmatically set the time on my computer. Thanks!
There are few suggestions i 've. Try using "shell32" interop and
Shell32.shell app = new Shell32.shell(); app.SetTime();
This display the Date/Time properties.. If you still wanna change it programmatically , you cxan try running the time system command by creating a Process.Process myProcess = new Process(); ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("time" "3"); myProcess.StartInfo = myProcessStartInfo.UseShellExecute; myProcess.Start();
Ragavendran Vaidhyanadhan -
There are few suggestions i 've. Try using "shell32" interop and
Shell32.shell app = new Shell32.shell(); app.SetTime();
This display the Date/Time properties.. If you still wanna change it programmatically , you cxan try running the time system command by creating a Process.Process myProcess = new Process(); ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("time" "3"); myProcess.StartInfo = myProcessStartInfo.UseShellExecute; myProcess.Start();
Ragavendran VaidhyanadhanI run "time" but there is no such a file.Could you tell me the name of file that is for Date/Time property? Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down
-
I run "time" but there is no such a file.Could you tell me the name of file that is for Date/Time property? Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down
Mazdak wrote: I run "time" but there is no such a file Hi Here, "Time " refers to the internal system built command. Try creating a temp file called "time.bat" and write "time 2:45" into it ( just like how you specify the time command in the command line .. ) and use the file to create the startupinfo. I am sure it will work. :) Ragavendran Vaidhyanadhan
-
Mazdak wrote: I run "time" but there is no such a file Hi Here, "Time " refers to the internal system built command. Try creating a temp file called "time.bat" and write "time 2:45" into it ( just like how you specify the time command in the command line .. ) and use the file to create the startupinfo. I am sure it will work. :) Ragavendran Vaidhyanadhan