CE & Timezones

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

When I insert records into SQL Server CE it does a
dateadd on its own upon inserting. It adds the timezone
that is in the setup of the PPC.

i.e: I am in EST (GMT + 5) so 17:00 becomes 12:00 in the
database.

I want to prevent this, is there a way??? If not how can
I get the current time setting so I can do a date add on
my own thereby reversing what it is going to do?

This is the last piece of my program!!!

Aaron
 
Aaron,
I've tried inserting datetime records using a literal Insert statement like
this:
cmd.CommandText = "insert into test (dt) values('01/01/03 10:27:52 AM')";

cmd.ExecuteNonQuery();

as well as command parameters:
SqlCeDataAdapter da = new SqlCeDataAdapter("select * from test", conn);

SqlCeCommandBuilder bld = new SqlCeCommandBuilder(da);

cmd = bld.GetInsertCommand();

cmd.Parameters[0].Value = DateTime.Parse("01/01/03 10:27:52 AM");

cmd.ExecuteNonQuery();

I never had a problem with changed date. Perhaps you could post a code
snippet
 
Back
Top