SetSystemTime

  • Thread starter Thread starter Johann
  • Start date Start date
Daylight savings plus GMT, maybe? Remember that SetSystemTime() sets the
***GMT*** of the unit, so it will be adjusted to find local time based on
where you've told it you are located. To set the time as local time, you
want SetLocalTime().

Paul T.
 
Johann,

I don't know if there's a better solution, but that's mine:

I retrieve date and time from the database server and then set the date/time

// Zeit = time; Datum = date

oClient.Execute("select current time " );
string _cZeit = oClient.Result.Rows[0][0].ToString();
oClient.Execute("select current date " );
string _cDatum = oClient.Result.Rows[0][0].ToString();
SetDateTime( _cDatum, _cZeit );


public static void SetDateTime( string _cDatum, string _cZeit )

System.DateTime oT ;
int _nOffset = DateTime.Now.ToUniversalTime().Hour - DateTime.Now.Hour;;
oT = Convert.ToDateTime( _cDatum );
oT = oT.AddHours( Convert.ToDouble( _cZeit.Substring(0,2)) +
Convert.ToDouble( _nOffset ) );
oT = oT.AddMinutes( Convert.ToDouble( _cZeit.Substring(3,2)) );
oT = oT.AddSeconds( Convert.ToDouble( _cZeit.Substring(6,2)) );
OpenNETCF.Win32.DateTimeEx.SetSystemTime(oT);

Ruediger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ANN: FAQ updates for 2/1/04 1
ANN: FAQ Updates 4
ANN: FAQ Updates 2
ANN: FAQ Updates 5
ANN: FAQ Update 1
Wait cursor 1
SetSystemTime() behaviour: Timezone jump 7
Cannot establish a connection 3

Back
Top