Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

T-SQL Expand / Collapse
Author
Message
Posted Monday, November 16, 2009 8:25 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 8:11 PM
Points: 5,571, Visits: 24,767
Comments posted to this topic are about the item T-SQL

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #819775
Posted Monday, November 16, 2009 8:47 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, July 24, 2014 7:55 PM
Points: 6,582, Visits: 8,860
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
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #819784
Posted Monday, November 16, 2009 10:47 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, July 25, 2013 8:39 AM
Points: 191, Visits: 270
the answer should be false because until unless ur on the same timezone as utc the day and hour will vary .
Post #819815
Posted Monday, November 16, 2009 10:50 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 3:41 AM
Points: 3,859, Visits: 4,998
UTC time will differ from current time anywhere in the world exept on Greenwich Meridian (i.e. 0 deg long)

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #819816
Posted Monday, November 16, 2009 11:36 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, October 28, 2013 3:12 PM
Points: 313, Visits: 253
The answer should be false. how come getdate() and getutcdate() will return the same value
Post #819829
Posted Monday, November 16, 2009 11:42 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, October 28, 2013 3:12 PM
Points: 313, Visits: 253
The answer should be false. how come getdate() and getutcdate() will return the same value
Post #819832
Posted Tuesday, November 17, 2009 12:29 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, July 25, 2014 4:18 AM
Points: 2,497, Visits: 1,136
If the UTC time is marked as UTC then I would say TRUE otherwise FALSE.
Post #819847
Posted Tuesday, November 17, 2009 12:52 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 10, 2014 1:48 AM
Points: 2,359, Visits: 730
Check http://msdn.microsoft.com/en-us/library/ms188383.aspx
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
Check getutcdate Example A same story

Not all of us reside in UK time zone
Post #819856
Posted Tuesday, November 17, 2009 1:08 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 3, 2014 2:45 AM
Points: 2,531, Visits: 536
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
Post #819860
Posted Tuesday, November 17, 2009 1:09 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Saturday, September 29, 2012 6:38 AM
Points: 276, Visits: 21
So, I answered correct but false. Who will apologize to me ?
Post #819861
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse