Skip to main content

Posts

Showing posts with the label DST

GETDATE() and DST in SQL Server Compact

We have had issues when synchronizing date and time in some handheld Windows CE devices. Time always seem to get an hour wrong and we have already confirmed that it has to do with Daylight Savings Time. But we have not figured out what and why until just recently. In some cases we have used the SQL method  GETDATE() , in other cases  DateTime.Now() . The case where the latter is used there are never any issues, but with  GETDATE() we get the one hour difference most of the time. This is simply caused by the settings and configuration in the handheld device and SQL Server Compact. A proper solution would be always to use  UTC -date in the application and the database to get rid of such problems. But since that would be a major change we decided to just go with using DateTime.Now()  instead of GETDATE() .