Skip to main content

We've worked on a desktop client application using entity framework, where some records should be saved in the database but the time needed to be consistent. In other words, all operators working at the same time on the application on different machines need to have the same time when edit records.

Below is code that could be used for getting datetime from database server in entity framework:

// This code will return time from database server
DataTime dbServerTime;
dbServerTime = context.CreateQuery<DateTime>("CurrentDateTime() ").AsEnumerable().FirstOrDefault();

- Advertisement -
- Advertisement -