Reputation: 4445
I have SQL Server Express 2008 on my local system and I am doing some insertions in a datetime
column.
The problem is that the same system on production on (SQL Server 2005) hosted on godaddy records a datetime
entry as the previous date and a time of 13:00
E.g. Date being inserted is 07/01/2010 00:00:00
Entry in Local DB = 07/01/2010 00:00:00
Entry in Prod DB = 06/30/2010 13:00:00
Could it be some server/db level setting for datetime
storage ?
Edit 1:
pls note, I'm inserting a predefined datetime
value, the date being inserted is exactly 07/01/2010 00:00:00
. I am NOT using GETDATE().
Edit 2: Solution
Ok, thanks for the answers guys but the problem was not from SQL Server, it was from the data being read from an XML form of the serialized dataset. It was sending the the datetime information as 'mm/dd/yyyy T00:00:00+4:00'
All i did was remove the remove the time segment from it and then insert it in the DB.
Cheers !
Upvotes: 0
Views: 808
Reputation: 100567
The time difference makes me wonder if this is a UTC thing. Are you running this via SSMS or via application code?
Does it always insert 11 hours behind your local?
Is that an explicit time you're giving the column, or is that the column default (perhaps GETUTCDATE ()
)?
Upvotes: 0
Reputation: 432210
GETDATE() gives SQL server time
You should use GETUTCDATE() to give GMT (UTC since we lost our empire it appears) which will be consistent globally.
Upvotes: 1