The ConnectionTime
property of the Connection
class represents the exact date and time when the connection was established. This property is useful for tracking the duration of a connection or for logging purposes.
The ConnectionTime
property of the Connection
class represents the exact date and time when the connection was established. This property is useful for tracking the duration of a connection or for logging purposes.
To access the ConnectionTime
property, you need an instance of the Connection
class. This property is read-only and returns a DateTimeOffset
value, which includes both the date and time of the connection establishment.
// Example of accessing the ConnectionTime property Connection connection = Connection.Find(someGuid); DateTimeOffset connectionTime = connection.ConnectionTime; // Output the connection time string formattedTime = connectionTime.ToString("yyyy-MM-dd HH:mm:ss"); // Use the formattedTime as needed, e.g., display it in a UI or log it.