Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ihave take two text boxes like login time and logout time of a employee attendancewebpage. how can it automaticaly calculate the total hours(logout time - login time)and show on the total hrs text box.
Posted
Comments
bbirajdar 19-Jul-12 5:54am    
Nothing happens automatically.. You will have to write the code for it

 
Share this answer
 
Read about TimeSpan. You need to find the difference between the logout time and the login time. Using Timespan, you get the difference in terms of hours/minutes/seconds, etc

Refer: MSDN: TimeSpan Structure[^]
 
Share this answer
 
hi amrit
try like this

C#
string loginTime = "13:45:26.836";
string logoutTime = "14:24:18.473";

TimeSpan interval = DateTime.Parse(loginTime ) - DateTime.Parse(logoutTime );


all the best

Thanks&&Regards

Sandeep
 
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