November 16, 2009 at 8:47 pm
When I run the four statements, I get:
2009-11-15 22:39:14.090 Sunday
2009-11-15 22:39:14.090 Sunday
2009-11-16 03:39:14.090 Monday
2009-11-16 03:39:14.090 Monday
Not the same day or hour. They're not returning the same values.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 16, 2009 at 10:47 pm
the answer should be false because until unless ur on the same timezone as utc the day and hour will vary .
November 16, 2009 at 10:50 pm
This was removed by the editor as SPAM
November 16, 2009 at 11:36 pm
The answer should be false. how come getdate() and getutcdate() will return the same value
November 16, 2009 at 11:42 pm
The answer should be false. how come getdate() and getutcdate() will return the same value
November 17, 2009 at 12:29 am
If the UTC time is marked as UTC then I would say TRUE otherwise FALSE.
November 17, 2009 at 12:52 am
Check http://msdn.microsoft.com/en-us/library/ms188383.aspx :w00t:
BTW: correct link for GetDate to this, there are double DateAdd links
Examples
The following examples use the six SQL Server system functions that return current date and time to return the date, time, or both. The values are returned in series; therefore, their fractional seconds might be different.
A. Getting the current system date and time
SELECT SYSDATETIME()
,SYSDATETIMEOFFSET()
,SYSUTCDATETIME()
,CURRENT_TIMESTAMP
,GETDATE()
,GETUTCDATE();
Here is the result set.
SYSDATETIME() 2007-04-30 13:10:02.0474381
SYSDATETIMEOFFSET()2007-04-30 13:10:02.0474381 -07:00
SYSUTCDATETIME() 2007-04-30 20:10:02.0474381
CURRENT_TIMESTAMP 2007-04-30 13:10:02.047
GETDATE() 2007-04-30 13:10:02.047
GETUTCDATE() 2007-04-30 20:10:02.047
Do you find GETDATE and GETUTCDATE results the same :blink:
Check getutcdate Example A β‘ same story
Not all of us reside in UK time zone :crazy:
November 17, 2009 at 1:08 am
rene-500237 (11/17/2009)
If the UTC time is marked as UTC then I would say TRUE otherwise FALSE.
I agree, everyone does not live in GMT zone or install our OS with GMT zone. π
/HΓ₯kan Winther
MCITP:Database Developer 2008
MCTS: SQL Server 2008, Implementation and Maintenance
MCSE: Data Platform
November 17, 2009 at 1:09 am
So, I answered correct but false. Who will apologize to me ? π
November 17, 2009 at 2:15 am
Correct answer should be FALSE, because i received next results:
2009-11-16 10:50:43.533
2009-11-16 10:50:43.533
2009-11-16 08:50:43.533
2009-11-16 08:50:43.533
I'm living in Ukraine and our Timezone = +2 Hours.
Please, accept my answer as correct. Thanks.
November 17, 2009 at 2:53 am
Thought about answering True, because for me (in the UK) they will return the same value, but figured that the author was probably in the US so the answer was therefore False. Wrong assumption!
November 17, 2009 at 3:25 am
Same for me. Not only that but depending on exactly WHEN you run this you may well be different seconds, given that getdate() etc will be called in 4 different calls. Ok, so that was only the difference between .393 and .403 on the ms, but if that happened at a second boundary then that would change the seconds value.
So all in all, wrong on so many levels.
November 17, 2009 at 3:45 am
Nice question: so, we could see the time zone of every user. π
I live in Italy +1 hour.
2009-11-16 11:42:01.793Monday
2009-11-16 11:42:01.793Monday
2009-11-16 10:42:01.793Monday
2009-11-16 10:42:01.793Monday
Ciao Ciao
November 17, 2009 at 4:29 am
The answer should be false.
When I run the four statements, I get:
2009-11-16 16:38:22.217Monday
2009-11-16 16:38:22.217Monday
2009-11-16 11:08:22.217Monday
2009-11-16 11:08:22.217Monday
Here time and minutes are different.
Viewing 15 posts - 1 through 15 (of 203 total)
You must be logged in to reply to this topic. Login to reply