Is it possible to record the duration from login to logout

I am creating a task manager app, when Someone login the app with their details and logout after the task gets completed , So that I need to get the time taken for the work to complete.

0 3 425
3 REPLIES 3

Yes, any DateTime operations result in a Duration type value.  For example, you could add a column named, maybe, "Online Duration" and then set it with an App Formula expression like this:

[Logout DateTime] - [Login DateTime]

Maybe you want this in hours instead so you could set "Hours Online" with this expression:

TOTALHOURS([Logout DateTime] - [Login DateTime]) 

More details on TOTALHOURS()

so, when someone logged in the app, I get the login time and when they logout I get logout time. Moreover, they logout if there is no work and they login when they get the work to do. So, can I get the total duration for work done for the day?

Yes.  I think you are suggesting there could be multiple login/logout entries for the day.  You would simply use the SUM() function to sum up the durations for each of these.

A side note, many sample apps for Time Tracking have Login as one table and Logout as another table OR have Login's and Logout's as separate row in a single table.  If you are just logging the activity then this approach is ok.

Because you are calculating and Summing durations, I instead recommend that you have a Time Entry table and record Login and the corresponding Logout in the same row - either as separate DateTime columns OR as Ref columns to separate Login/Logout tables.   This allows you to compute the durations much more easily as well as makes it easier to ensure there are corresponding Logout's to every Login.