refactoring code for formatting dates
calculation of duration time, functional back button soft and phisical