Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to get server machine date and time because nobody can change system date and time.
Actually when I take attendence server date and time should be consider not local machine on which I taking attendence.
Error may be employee change the system date and time.I want prevent them.
Posted
Updated 26-Apr-12 19:50pm
v4
Comments
S@53K^S 24-Apr-12 9:02am    
Is this all your problem is if that is so you can use the DateTime.now().If you could elaborate the problem you may get a better solution

I do not fully understand what your requirement is. Since you added a "SQL2005" tag, I suppose you need a query for getting the date and time:
SQL
SELECT CURRENT_TIMESTAMP
 
Share this answer
 
Comments
Member 7909353 24-Apr-12 9:22am    
I am using DateTime.Now.ToString("T") but this not sufficient.
Reza Ahmadi 24-Apr-12 9:36am    
5!
For SQL Server 2005, you get the current date and time on the database server using GETDATE. Details of this function can be found here[^].
 
Share this answer
 
Comments
Member 7909353 24-Apr-12 9:23am    
I am using DateTime.Now.ToString()
Pete O'Hanlon 24-Apr-12 10:36am    
I'm not sure what you're getting at here. Is the SQL Server tag unimportant? If you want to get the date and time to store against a record in SQL Server, then use GetDate(). If not, then use one of the solutions defined here: http://stackoverflow.com/questions/1008111/how-do-i-get-the-exact-time-for-a-remote-server-in-c-sharp

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