Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
See more:
how to insert current time in procedure through the procedure?
Posted
Comments
Homero Rivera 23-Apr-15 13:47pm    
use getdate() which returns the current date and time, try "select getdate()" to see example
Maciej Los 23-Apr-15 15:00pm    
Wha t have you tried till now?

1 solution

Use the SYSDATETIME() function[^].

E.g. SELECT CONVERT (time, SYSDATETIME())
 
Share this answer
 
Comments
Richard Deeming 23-Apr-15 16:10pm    
NB: That returns the current time for the server's current time-zone and DST settings. It's almost always better to store times in UTC (SYSUTCDATETIME[^]) and convert them to the user's time-zone when displaying them.

Alternatively, for SQL 2008 or higher, store the times using the datetimeoffset type[^], and the SYSDATETIMEOFFSET function[^].

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