I have a strange thing happening to my DateTime field in every record being saved to SQL Server. My SQL Server is in Texas (central time zone) but my application is running in pacific time. The computer has the correct pacific time zone time set on it. Every record in the SQL Server database has this time set two hours ahead.
I am getting my time from DateTime.Now and then setting a property in an Entity that gets saved to the table.
>pre>
.. bunch of code
//Reset the lastLogTime
this.lastLogTime = DateTime.Now;
.. some code that doesn't touch the lastLogTime
// Build the SpotStarter object
SpotStarterEntity oSpotStarter = new SpotStarterEntity();
oSpotStarter.Track_id = Guid.NewGuid();
oSpotStarter.Record_Status = type;
oSpotStarter.Spot_Latitude = lat;
oSpotStarter.Spot_Longitude = lon;
oSpotStarter.Spot_Time = lastLogTime;
... Set more properties in the Entity
// Save this Entity
Since I am also in CT I don't know if I can conclusively test this, but I suppose I could change my computer timezone to something else and try that. Anybody have any ideas why this would happen.
Tim
Updated: Ok, I forgot to mention that I am using Mere Mortals framework which I will work through and also WCF to get the data up to the server. Might be something in those things, as DateTime.Now sure should just get local computer time.
Timothy Bryan