Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is there any way to count the time from login to logout in c#
Posted

Hi,

Store the login time and calculate the logout time from login time when they logged out.

You can use session,cookie or DB as storage.
 
Share this answer
 
Hope this articl helps
Tracking users login/logout time
you can calculate time span from Login time and logout time
 
Share this answer
 
Record the login time in a variable, when they logout, record that and subtract.

Once you have the difference, you can simply put it in the textbox.

use DateTime.Subtract method
 
Share this answer
 
Hi,

Hope thios helps you.
C#
TimeSpan t;
t = Convert.ToDateTime(Stoptime).Subtract(Convert.ToDateTime(starttime));
 totaltime = t.Minutes + (t.Hours * 60) + ((Convert.ToSingle(t.Seconds) /60))  ;
 
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