KoolKabin
KoolKabin

Reputation: 17703

Appropriate method to get time of server computer?

I do have my program running in a network. I have set one main computer as server and installed database system too. My other clients create transaction and saves it to database. Now I need to add date and time of server too in that record

Upvotes: 0

Views: 1967

Answers (1)

Dennis Traub
Dennis Traub

Reputation: 51674

If your application is running on the server, you can get the local time through the DateTime.Now property.

If your application is only running on the client and you have no server-side application, only the database, you can include CURRENT_TIMESTAMP or the GETDATE() function to you SQL statement. (Assuming you're running SQL Server).

Upvotes: 1

Related Questions