Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the current datetime of SQL Server
Message
From
01/02/2011 17:51:04
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01498217
Message ID:
01498231
Views:
46
>>>>Very stupid question, but can you simply use SELECT GETDATE() ?
>>>
>>>Celko prefers CURRENT_TIMESTAMP as he says Getdate() is propriatery...
>>>
>>>But I use GETDATE() myself mostly...
>>
>>Proprietary to sqlserver you mean?
>
>Yes.

I thought you had to adjust for timezone though if you used that...

I have this that I got from help at some point in time that I used for testing:

SELECT SYSDATETIME()
,SYSDATETIMEOFFSET()
,SYSUTCDATETIME()
,CURRENT_TIMESTAMP
,GETDATE()
,GETUTCDATE();

and:

SELECT CONVERT (time, SYSDATETIME())
,CONVERT (time, SYSDATETIMEOFFSET())
,CONVERT (time, SYSUTCDATETIME())
,CONVERT (time, CURRENT_TIMESTAMP)
,CONVERT (time, GETDATE())
,CONVERT (time, GETUTCDATE());

to see the difference...
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform