cancel
Showing results for 
Search instead for 
Did you mean: 

How to get end date or calculate end date

cris
Mt. Kenya

Hi everyone!

In the getActivity api response there is only start_date and no end_date. Currently I need to know the time when the most users finish their activity. i want to know exactly total time from start to end activity (moving time, elapsed_time, pause activity time )

Thanks everyone!

2 REPLIES 2

burgom
Mt. Kenya

moving_time: is the exact time of the activity in seconds

elapsed_time: is the duration of the activity with some movement

pause activity time: moving_time-elapsed_time

With timestamp or timedelta you can take the finish datetime

I believe you've flipped the meaning of moving_time and elapsed_time.

elapsed_time is the total amount of time from when the activity started to when it ended, including all pauses.

moving_time is the number of seconds spent actively moving (elapsed_time - paused time)

Both moving_time and elapsed_time are provided in getActivity. So for the requested information:

  • moving_time is moving_time from getActivity
  • elapsed_time is elapsed_time from getActivity
  • Activity start time is start_date from getActivity (note: start_date is GMT, use start_date_local for local timezone)
  • pause_activity_time = elapsed_time - moving_time
  • Activity end time is start_date + elapsed_time