February 15, 2013 at 8:15 am
crmitchell (2/15/2013)
L' Eomot Inversé (2/15/2013)
What worries me there is that - even with the very appropriate emoticon - the person to whom you replied may be insufficiently awake to detect your sarcasm. But I still wish I could have gotten in first with a response like yours :exclamationmark:
I noticed it several hours ago but as it just supported my point didn't feel it needed a response.
Tom, you were right!
the client and server that the user is using are set to different timezones from each other and that the country settings of the server does not match the default for that time zone.
There is nothing in the question that implies any of this.
That that timezone is different from my own generally is irrelevant.
You are correct!
Although in this case as my timezone is GMT which is for practical purposes the same as UTC it opens up the possibility that two of the answers will in that particular situation generate the same result.
You mean in that particular situation which isn't the one implied by the question...
Joey is a Budgie
Yes, I think he probably is.
February 15, 2013 at 8:28 am
sipas (2/15/2013)
crmitchell (2/15/2013)
L' Eomot Inversé (2/15/2013)
What worries me there is that - even with the very appropriate emoticon - the person to whom you replied may be insufficiently awake to detect your sarcasm. But I still wish I could have gotten in first with a response like yours :exclamationmark:
the client and server that the user is using are set to different timezones from each other and that the country settings of the server does not match the default for that time zone.
There is nothing in the question that implies any of this.
.
And that is the problem. If you think that try carrying out the query at that time on a set of client and server set to any other time offset and see if you get the expected result.
The date format given is US specific. - Implied by the question
The time returned by the server being offset implies the two boxes are set to different times - again implied by the question.
That the date format does not match the default format for those countries offset from the US time zones also implies the last part.
February 15, 2013 at 10:44 am
crmitchell (2/15/2013)
The time returned by the server being offset implies the two boxes are set to different times
But what implies there are two boxes?
I can tell you're not gong to be convinced(!), but just so others are clear, I think this is what you should take away from the question - to quote BOL:
SYSDATETIME returns the date and time of the computer on which the instance of SQL Server is running
SYSUTCDATETIME returns the date and time of the computer on which the instance of SQL Server is running. The date and time is returned as UTC time (Coordinated Universal Time).
Therefore, on the computer on which the instance of SQL Server is running, if the system date and time is not UTC, SYSUTCDATETIME will return a different date and time to the system date and time. There is only one computer involved.
A question about two computers set to different timezones is a completely different question, possibly an interesting question, but not this question.
February 16, 2013 at 1:58 pm
+1
Yeah, timezones.
There is one time! that is NOW().
February 18, 2013 at 2:10 am
sipas (2/15/2013)
But what implies there are two boxes?
Nothing.
What suggests there is only one?
Nothing.
Either requires an assumption.
February 19, 2013 at 12:29 am
+1. Nice question.
March 13, 2013 at 8:06 am
Yet another question that deserves to be removed along with all associated points (or lack thereof), as this is clearly dependent on not only WHEN you answer the question, but WHERE you happen to be in the world at the time. I "incorrectly" assumed that the composer would take that into account, and that therefore, such a bias wouldn't make it into a question, and that therefore the answer SYSDATETIME() was good enough based on format alone. While I "discovered" that SYSUTCDATETIME() also uses the same format, that's hardly useful information, given that I won't be using it for any reason from where I'm located. Please consider the value of the question before deciding it's a good one.
Steve (aka sgmunson)
Rent Servers for Income (picks and shovels strategy)
March 13, 2013 at 8:09 am
sgmunson (3/13/2013)
Please consider the value of the question before deciding it's a good one.
Please consider the value of your reply before adding the thousandth identical "this question is wrong" post
March 13, 2013 at 10:17 am
Hugo Kornelis (2/13/2013)
I had almost missed the different time in the returned output, as I was focusing completely on the data type. Caught is just in time!I do not agree with some of the comments here that time zone of the computer was required to answer this. Once I saw that the time portion of the result was not the same as the listed system time, there was only one option left anyway.
+1
I got it right with time part...
June 15, 2015 at 3:57 pm
why not CURRENT_TIMESTAMP??
Thanks.
Viewing 10 posts - 46 through 55 (of 55 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy