Click here to Skip to main content
15,903,743 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to get date time from sql server
Posted
Updated 14-Jul-11 2:59am
v2

GetDate() will return the date and time
 
Share this answer
 
 
Share this answer
 
there are a couple of ways you can do this depending on how accurate you want the date and also weather it must be local server time or not

SQL
SELECT SYSDATETIME() as [SYSDATETIME]
    ,SYSDATETIMEOFFSET() as [SYSDATETIMEOFFSET]
    ,SYSUTCDATETIME() as [SYSUTCDATETIME]
    ,CURRENT_TIMESTAMP as [CURRENT_TIMESTAMP]
    ,GETDATE() as [GETDATE]
    ,GETUTCDATE() as [GETUTCDATE];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900