If I run these two functions I am getting different result. The datetime.Now
in dotnet is showing the same result as it is showing in the system time while there is a difference of around 20 minutes if i use getdate()
... what is the cause, and how to overcome this?
The 2 machines have different system times.
GETDATE
gets time from the server where SQL Server is installed (where it runs).DateTime.Now
gets time from the App or Web server or your local PC.Don't mix up "machine that sends GETDATE()
command" and "machine that runs it".
You can use the Windows Time Service to synchronize machine's clocks.
http://support.microsoft.com/kb/307897
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With