node-mssql icon indicating copy to clipboard operation
node-mssql copied to clipboard

Dealing with timezones

Open polson136 opened this issue 10 years ago • 3 comments

The database I am connecting to (SQL Server 2008) has many datetime columns in it. The dates are stored in the server's local time. When I use mssql time, the dates are interpreted according to GMT. I have tried setting useUTC: false in the connection configuration, but have not had any success. Is there any way to correct this? If not simply, is there a function I can override to correct this behavior?

I'm not sure whether this is a bug, a feature, or a lack of documentation, but I'm not really sure what to do about this, short of iterating over all of the results and subtracting 5-6 hours from them.

polson136 avatar May 19 '16 22:05 polson136

I have the same issue. Tried config.options.useUTC=false, no difference.

slasktrat avatar May 30 '16 11:05 slasktrat

Same issue ++

vicmonmena avatar Jun 10 '16 07:06 vicmonmena

Disabling useUTC option means both database and nodejs must in the same timezone. The best way to ensure timezone is right is to use datetimeoffset data type.

patriksimek avatar Sep 03 '16 15:09 patriksimek