MSSQL weird date issue

battletoad

Expert Member
Joined
Mar 10, 2009
Messages
1,461
Reaction score
52
I'm running Fedora 31, and have MSSQL installed.

I've a weird issue where it seems that GETDATE() and GETUTCDATE() returns what looks to be a cached value, whereas SYSDATETIMEOFFSET() returns the proper date:
SQL:
1> select SYSDATETIMEOFFSET() as sysdate, GETUTCDATE() as utcdate
2> go
sysdate                                       utcdate               
--------------------------------------------- -----------------------
           2020-06-28 16:36:48.3827305 +02:00 2020-06-27 20:35:46.440

(1 rows affected)

I can't seem to google my way thru this one. Has anyone come across something like this?
 
That's odd.

Sysdatetimeoffset returns the host system clock

Returns a datetimeoffset(7) value that contains the date and time of the computer on which the instance of SQL Server is running. The time zone offset is included.

GetUTCDate returns the database clock settings which "should be the same as the system clock "

Returns the current database system timestamp as a datetime value. The database time zone offset is not included.

Possibly there is some setting on a db level that is causing that behavior but I haven't come across such to be honest.

In the old sayings, have you tried restarting the instance?

*edit* is there maybe a container or virtual service running?
 
Last edited:
Yeah, restarted the service, and it's all hunky dory now. Always remember to restart first hey ;)

Funny thing is, I recall having had the same issue a few weeks back where the date got stuck. It's probably a confluence of configs on my system that's causing this issue. May as well get around to that system redo that I've been putting off for some time :sneaky:
 
Top
Sign up to the MyBroadband newsletter
X