Duration as in Meeting module

I want to create a duration field ito my custom module to calculate the length of duration of the account visitation for my salesperson just like how the duration in meeting module does; I have created the start date with time and end date with time, but I have no idea how to calculate the time spend, can anyone share how could I do it?

Thank you very much in advance.

Maybe this one is similar enough to get you going

https://suitecrm.com/forum/suitecrm-7-0-discussion/15154-is-there-logic-hook-for-detailsview

you will need to do some changes, of course.