how can I change the system current date (time) using c#?

  • Thread starter Thread starter George LAZAR
  • Start date Start date
I'm not sure about C#, but you can use WIN API call:

SYSTEMTIME st;
SetSystemTime(&st))

or directly invoke a DOS command (sorry Java :-)

string newDate = "01-06-04";
string newTime = "8:30";
Runtime.getRuntime().exec("CMD /c \"DATE " + newDate + "\"");
Runtime.getRuntime().exec("CMD /c \"TIME " + newTime + "\"");
 
Back
Top