Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I need the code to store current time in database..... Please Help me.....
Updated 22-Dec-13 3:14am
Dave Kreskowiak 22-Dec-13 0:51am    
What have you tried?
Richard MacCutchan 22-Dec-13 3:48am    
Try the INSERT statement.
Nelek 22-Dec-13 9:14am    
With a simple google search you would have been faster than asking here.
Mike Meinz 22-Dec-13 9:19am    
Do you want the SQL Server's time or the client's time?

Client time
Use C# DateTime.Now property

SQL Server time
Use SQL Server function GetDate()
Peter Leow 22-Dec-13 9:32am    
Just the current time without the date part? It may be client based or server based, which one? Please edit your question to provide more details.

1 solution

try this

insert into MyTable (MyColumn) values (getdate());
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